Skip to content

Commit 9862489

Browse files
committed
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
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
2 parents 426d266 + 2dbe10a commit 9862489

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎drivers/target/iscsi/iscsi_target.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3584,6 +3584,10 @@ static int handle_response_queue(struct iscsi_conn *conn)
35843584
spin_lock_bh(&cmd->istate_lock);
35853585
cmd->i_state = ISTATE_SENT_STATUS;
35863586
spin_unlock_bh(&cmd->istate_lock);
3587+
3588+
if (atomic_read(&conn->check_immediate_queue))
3589+
return 1;
3590+
35873591
continue;
35883592
} else if (ret == 2) {
35893593
/* Still must send status,
@@ -3673,7 +3677,7 @@ static int handle_response_queue(struct iscsi_conn *conn)
36733677
}
36743678

36753679
if (atomic_read(&conn->check_immediate_queue))
3676-
break;
3680+
return 1;
36773681
}
36783682

36793683
return 0;
@@ -3717,12 +3721,15 @@ int iscsi_target_tx_thread(void *arg)
37173721
signal_pending(current))
37183722
goto transport_err;
37193723

3724+
get_immediate:
37203725
ret = handle_immediate_queue(conn);
37213726
if (ret < 0)
37223727
goto transport_err;
37233728

37243729
ret = handle_response_queue(conn);
3725-
if (ret == -EAGAIN)
3730+
if (ret == 1)
3731+
goto get_immediate;
3732+
else if (ret == -EAGAIN)
37263733
goto restart;
37273734
else if (ret < 0)
37283735
goto transport_err;

‎drivers/target/sbp/sbp_target.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,7 @@ static int __init sbp_init(void)
25982598
return 0;
25992599
};
26002600

2601-
static void sbp_exit(void)
2601+
static void __exit sbp_exit(void)
26022602
{
26032603
sbp_deregister_configfs();
26042604
};

‎drivers/target/target_core_file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ static int __init fileio_module_init(void)
631631
return transport_subsystem_register(&fileio_template);
632632
}
633633

634-
static void fileio_module_exit(void)
634+
static void __exit fileio_module_exit(void)
635635
{
636636
transport_subsystem_release(&fileio_template);
637637
}

‎drivers/target/target_core_iblock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ static int __init iblock_module_init(void)
821821
return transport_subsystem_register(&iblock_template);
822822
}
823823

824-
static void iblock_module_exit(void)
824+
static void __exit iblock_module_exit(void)
825825
{
826826
transport_subsystem_release(&iblock_template);
827827
}

‎drivers/target/target_core_pscsi.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,14 @@ static void pscsi_bi_endio(struct bio *bio, int error)
840840
bio_put(bio);
841841
}
842842

843-
static inline struct bio *pscsi_get_bio(int sg_num)
843+
static inline struct bio *pscsi_get_bio(int nr_vecs)
844844
{
845845
struct bio *bio;
846846
/*
847847
* Use bio_malloc() following the comment in for bio -> struct request
848848
* in block/blk-core.c:blk_make_request()
849849
*/
850-
bio = bio_kmalloc(GFP_KERNEL, sg_num);
850+
bio = bio_kmalloc(GFP_KERNEL, nr_vecs);
851851
if (!bio) {
852852
pr_err("PSCSI: bio_kmalloc() failed\n");
853853
return NULL;
@@ -940,7 +940,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
940940
bio = NULL;
941941
}
942942

943-
page++;
944943
len -= bytes;
945944
data_len -= bytes;
946945
off = 0;
@@ -952,7 +951,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
952951
while (*hbio) {
953952
bio = *hbio;
954953
*hbio = (*hbio)->bi_next;
955-
bio->bi_next = NULL;
956954
bio_endio(bio, 0); /* XXX: should be error */
957955
}
958956
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
@@ -1092,7 +1090,6 @@ pscsi_execute_cmd(struct se_cmd *cmd)
10921090
while (hbio) {
10931091
struct bio *bio = hbio;
10941092
hbio = hbio->bi_next;
1095-
bio->bi_next = NULL;
10961093
bio_endio(bio, 0); /* XXX: should be error */
10971094
}
10981095
ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
@@ -1178,7 +1175,7 @@ static int __init pscsi_module_init(void)
11781175
return transport_subsystem_register(&pscsi_template);
11791176
}
11801177

1181-
static void pscsi_module_exit(void)
1178+
static void __exit pscsi_module_exit(void)
11821179
{
11831180
transport_subsystem_release(&pscsi_template);
11841181
}

0 commit comments

Comments
 (0)