Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Mar 2013 19:43:27 +0000 (11:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Mar 2013 19:43:27 +0000 (11:43 -0800)
Pull SCSI target patches from Nicholas Bellinger:
 "Here are the remaining target-pending patches for v3.9-rc1.

  The most important one here is the immediate queue starvation
  regression fix for iscsi-target, which addresses a bug that's
  effecting v3.5+ kernels under heavy sustained READ only workloads.
  Thanks alot to Benjamin Estrabaud for helping to track this down!

  Also included is a pSCSI exception bugfix from Asias, along with a
  handful of other minor changes.  Both bugfixes are CC'ed to stable."

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  target/pscsi: Rename sg_num to nr_vecs in pscsi_get_bio()
  target/pscsi: Fix page increment
  target/pscsi: Drop unnecessary NULL assignment to bio->bi_next
  target: Add __exit annotation for module_exit functions
  iscsi-target: Fix immediate queue starvation regression with DATAIN

1  2 
drivers/target/iscsi/iscsi_target.c
drivers/target/sbp/sbp_target.c
drivers/target/target_core_file.c

index 9435a3d369a7b8aa7f8e628ea2c32f0845b1f2a2,af77396234a2dd083af1aea8c3ef39e9d3aafa80..7ea246a07731e17964e904c34f5fff5f4769774c
@@@ -144,24 -144,23 +144,24 @@@ struct iscsi_tiqn *iscsit_add_tiqn(unsi
        spin_lock_init(&tiqn->login_stats.lock);
        spin_lock_init(&tiqn->logout_stats.lock);
  
 -      if (!idr_pre_get(&tiqn_idr, GFP_KERNEL)) {
 -              pr_err("idr_pre_get() for tiqn_idr failed\n");
 -              kfree(tiqn);
 -              return ERR_PTR(-ENOMEM);
 -      }
        tiqn->tiqn_state = TIQN_STATE_ACTIVE;
  
 +      idr_preload(GFP_KERNEL);
        spin_lock(&tiqn_lock);
 -      ret = idr_get_new(&tiqn_idr, NULL, &tiqn->tiqn_index);
 +
 +      ret = idr_alloc(&tiqn_idr, NULL, 0, 0, GFP_NOWAIT);
        if (ret < 0) {
 -              pr_err("idr_get_new() failed for tiqn->tiqn_index\n");
 +              pr_err("idr_alloc() failed for tiqn->tiqn_index\n");
                spin_unlock(&tiqn_lock);
 +              idr_preload_end();
                kfree(tiqn);
                return ERR_PTR(ret);
        }
 +      tiqn->tiqn_index = ret;
        list_add_tail(&tiqn->tiqn_list, &g_tiqn_list);
 +
        spin_unlock(&tiqn_lock);
 +      idr_preload_end();
  
        pr_debug("CORE[0] - Added iSCSI Target IQN: %s\n", tiqn->tiqn);
  
@@@ -3584,6 -3583,10 +3584,10 @@@ check_rsp_state
                                spin_lock_bh(&cmd->istate_lock);
                                cmd->i_state = ISTATE_SENT_STATUS;
                                spin_unlock_bh(&cmd->istate_lock);
+                               if (atomic_read(&conn->check_immediate_queue))
+                                       return 1;
                                continue;
                        } else if (ret == 2) {
                                /* Still must send status,
                }
  
                if (atomic_read(&conn->check_immediate_queue))
-                       break;
+                       return 1;
        }
  
        return 0;
@@@ -3717,12 -3720,15 +3721,15 @@@ restart
                     signal_pending(current))
                        goto transport_err;
  
+ get_immediate:
                ret = handle_immediate_queue(conn);
                if (ret < 0)
                        goto transport_err;
  
                ret = handle_response_queue(conn);
-               if (ret == -EAGAIN)
+               if (ret == 1)
+                       goto get_immediate;
+               else if (ret == -EAGAIN)
                        goto restart;
                else if (ret < 0)
                        goto transport_err;
index 6917a9e938e7b152eac6e9fddcca399961c796ba,9d3dadeed82fe01e03cea786cce36c7916b18848..d3536f57444fb7a51bd5313f157e85493d19d6de
@@@ -1719,7 -1719,7 +1719,7 @@@ static struct se_node_acl *sbp_alloc_fa
  
        nacl = kzalloc(sizeof(struct sbp_nacl), GFP_KERNEL);
        if (!nacl) {
 -              pr_err("Unable to alocate struct sbp_nacl\n");
 +              pr_err("Unable to allocate struct sbp_nacl\n");
                return NULL;
        }
  
@@@ -2598,7 -2598,7 +2598,7 @@@ static int __init sbp_init(void
        return 0;
  };
  
- static void sbp_exit(void)
+ static void __exit sbp_exit(void)
  {
        sbp_deregister_configfs();
  };
index d226c10a985bd9ffac1b3a87f8d9891d0c197683,2936cfe41dc12c960ed86ed0a91d0a09bab75f1f..17a6acbc3ab0e300b1db04717ecf68804358319f
@@@ -270,7 -270,7 +270,7 @@@ static int fd_do_rw(struct se_cmd *cmd
                 * the expected virt_size for struct file w/o a backing struct
                 * block_device.
                 */
 -              if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) {
 +              if (S_ISBLK(file_inode(fd)->i_mode)) {
                        if (ret < 0 || ret != cmd->data_length) {
                                pr_err("%s() returned %d, expecting %u for "
                                                "S_ISBLK\n", __func__, ret,
@@@ -631,7 -631,7 +631,7 @@@ static int __init fileio_module_init(vo
        return transport_subsystem_register(&fileio_template);
  }
  
- static void fileio_module_exit(void)
+ static void __exit fileio_module_exit(void)
  {
        transport_subsystem_release(&fileio_template);
  }