]> err.no Git - linux-2.6/blobdiff - drivers/s390/scsi/zfcp_aux.c
[SCSI] allow sleeping in ->eh_abort_handler()
[linux-2.6] / drivers / s390 / scsi / zfcp_aux.c
index a393cf4d0313cb22c7c8449168749b3b88a7744d..e17b4d58a9f6d6a5b1d3009c141fdaf26123d6cd 100644 (file)
@@ -52,19 +52,18 @@ static inline int zfcp_sg_list_copy_from_user(struct zfcp_sg_list *,
 static inline int zfcp_sg_list_copy_to_user(void __user *,
                                            struct zfcp_sg_list *, size_t);
 
-static int zfcp_cfdc_dev_ioctl(struct inode *, struct file *,
-       unsigned int, unsigned long);
+static long zfcp_cfdc_dev_ioctl(struct file *, unsigned int, unsigned long);
 
 #define ZFCP_CFDC_IOC_MAGIC                     0xDD
 #define ZFCP_CFDC_IOC \
        _IOWR(ZFCP_CFDC_IOC_MAGIC, 0, struct zfcp_cfdc_sense_data)
 
-#ifdef CONFIG_COMPAT
-static struct ioctl_trans zfcp_ioctl_trans = {ZFCP_CFDC_IOC, (void*) sys_ioctl};
-#endif
 
 static struct file_operations zfcp_cfdc_fops = {
-       .ioctl = zfcp_cfdc_dev_ioctl
+       .unlocked_ioctl = zfcp_cfdc_dev_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl = zfcp_cfdc_dev_ioctl
+#endif
 };
 
 static struct miscdevice zfcp_cfdc_misc = {
@@ -98,11 +97,6 @@ MODULE_PARM_DESC(loglevel,
                 "FC ERP QDIO CIO Config FSF SCSI Other, "
                 "levels: 0=none 1=normal 2=devel 3=trace");
 
-#ifdef ZFCP_PRINT_FLAGS
-u32 flags_dump = 0;
-module_param(flags_dump, uint, 0);
-#endif
-
 /****************************************************************/
 /************** Functions without logging ***********************/
 /****************************************************************/
@@ -224,13 +218,20 @@ zfcp_in_els_dbf_event(struct zfcp_adapter *adapter, const char *text,
  * Parse "device=..." parameter string.
  */
 static int __init
-zfcp_device_setup(char *str)
+zfcp_device_setup(char *devstr)
 {
-       char *tmp;
+       char *tmp, *str;
+       size_t len;
 
-       if (!str)
+       if (!devstr)
                return 0;
 
+       len = strlen(devstr) + 1;
+       str = (char *) kmalloc(len, GFP_KERNEL);
+       if (!str)
+               goto err_out;
+       memcpy(str, devstr, len);
+
        tmp = strchr(str, ',');
        if (!tmp)
                goto err_out;
@@ -247,10 +248,12 @@ zfcp_device_setup(char *str)
        zfcp_data.init_fcp_lun = simple_strtoull(tmp, &tmp, 0);
        if (*tmp != '\0')
                goto err_out;
+       kfree(str);
        return 1;
 
  err_out:
        ZFCP_LOG_NORMAL("Parse error for device parameter string %s\n", str);
+       kfree(str);
        return 0;
 }
 
@@ -308,23 +311,16 @@ zfcp_module_init(void)
        if (!zfcp_transport_template)
                return -ENODEV;
 
-       retval = register_ioctl32_conversion(zfcp_ioctl_trans.cmd,
-                                            zfcp_ioctl_trans.handler);
-       if (retval != 0) {
-               ZFCP_LOG_INFO("registration of ioctl32 conversion failed\n");
-               goto out;
-       }
-
        retval = misc_register(&zfcp_cfdc_misc);
        if (retval != 0) {
                ZFCP_LOG_INFO("registration of misc device "
                              "zfcp_cfdc failed\n");
-               goto out_misc_register;
-       } else {
-               ZFCP_LOG_TRACE("major/minor for zfcp_cfdc: %d/%d\n",
-                              ZFCP_CFDC_DEV_MAJOR, zfcp_cfdc_misc.minor);
+               goto out;
        }
 
+       ZFCP_LOG_TRACE("major/minor for zfcp_cfdc: %d/%d\n",
+                      ZFCP_CFDC_DEV_MAJOR, zfcp_cfdc_misc.minor);
+
        /* Initialise proc semaphores */
        sema_init(&zfcp_data.config_sema, 1);
 
@@ -348,8 +344,6 @@ zfcp_module_init(void)
 
  out_ccw_register:
        misc_deregister(&zfcp_cfdc_misc);
- out_misc_register:
-       unregister_ioctl32_conversion(zfcp_ioctl_trans.cmd);
  out:
        return retval;
 }
@@ -370,9 +364,9 @@ zfcp_module_init(void)
  *              -EPERM      - Cannot create or queue FSF request or create SBALs
  *              -ERESTARTSYS- Received signal (is mapped to EAGAIN by VFS)
  */
-static int
-zfcp_cfdc_dev_ioctl(struct inode *inode, struct file *file,
-                    unsigned int command, unsigned long buffer)
+static long
+zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
+                   unsigned long buffer)
 {
        struct zfcp_cfdc_sense_data *sense_data, __user *sense_data_user;
        struct zfcp_adapter *adapter = NULL;
@@ -535,7 +529,7 @@ zfcp_cfdc_dev_ioctl(struct inode *inode, struct file *file,
 
  out:
        if (fsf_req != NULL)
-               zfcp_fsf_req_cleanup(fsf_req);
+               zfcp_fsf_req_free(fsf_req);
 
        if ((adapter != NULL) && (retval != -ENXIO))
                zfcp_adapter_put(adapter);
@@ -1164,7 +1158,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
        INIT_LIST_HEAD(&adapter->port_remove_lh);
 
        /* initialize list of fsf requests */
-       rwlock_init(&adapter->fsf_req_list_lock);
+       spin_lock_init(&adapter->fsf_req_list_lock);
        INIT_LIST_HEAD(&adapter->fsf_req_list_head);
 
        /* initialize abort lock */
@@ -1249,9 +1243,9 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
        zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev);
        dev_set_drvdata(&adapter->ccw_device->dev, NULL);
        /* sanity check: no pending FSF requests */
-       read_lock_irqsave(&adapter->fsf_req_list_lock, flags);
+       spin_lock_irqsave(&adapter->fsf_req_list_lock, flags);
        retval = !list_empty(&adapter->fsf_req_list_head);
-       read_unlock_irqrestore(&adapter->fsf_req_list_lock, flags);
+       spin_unlock_irqrestore(&adapter->fsf_req_list_lock, flags);
        if (retval) {
                ZFCP_LOG_NORMAL("bug: adapter %s (%p) still in use, "
                                "%i requests outstanding\n",
@@ -1493,19 +1487,15 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
                fcp_rscn_element++;
                switch (fcp_rscn_element->addr_format) {
                case ZFCP_PORT_ADDRESS:
-                       ZFCP_LOG_FLAGS(1, "ZFCP_PORT_ADDRESS\n");
                        range_mask = ZFCP_PORTS_RANGE_PORT;
                        break;
                case ZFCP_AREA_ADDRESS:
-                       ZFCP_LOG_FLAGS(1, "ZFCP_AREA_ADDRESS\n");
                        range_mask = ZFCP_PORTS_RANGE_AREA;
                        break;
                case ZFCP_DOMAIN_ADDRESS:
-                       ZFCP_LOG_FLAGS(1, "ZFCP_DOMAIN_ADDRESS\n");
                        range_mask = ZFCP_PORTS_RANGE_DOMAIN;
                        break;
                case ZFCP_FABRIC_ADDRESS:
-                       ZFCP_LOG_FLAGS(1, "ZFCP_FABRIC_ADDRESS\n");
                        range_mask = ZFCP_PORTS_RANGE_FABRIC;
                        break;
                default:
@@ -1772,7 +1762,10 @@ static void zfcp_ns_gid_pn_handler(unsigned long data)
        ct_iu_req = zfcp_sg_to_address(ct->req);
        ct_iu_resp = zfcp_sg_to_address(ct->resp);
 
-       if ((ct->status != 0) || zfcp_check_ct_response(&ct_iu_resp->header)) {
+       if (ct->status != 0)
+               goto failed;
+
+       if (zfcp_check_ct_response(&ct_iu_resp->header)) {
                /* FIXME: do we need some specific erp entry points */
                atomic_set_mask(ZFCP_STATUS_PORT_INVALID_WWPN, &port->status);
                goto failed;