Skip to contentSkip to conversation

tcm/pscsi: Fix failure case for __pscsi_map_task_SG()

PATCH New Nicholas A. Bellinger 1 participant 1 message Nov 9, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcm/pscsi: Fix failure case for __pscsi_map_task_SG()

From: Nicholas Bellinger <[email protected]>

The 'ret' value in __pscsi_map_task_SG() needs to be set to the failure code that will be handled in transport_generic_new_cmd() as each struct se_task->transport_map_task() is executed. This patch fixes the pSCSI se_task map_task_SG() callers to return the OUT_OF_MEMORY macro from target_core_transport.h to signal a failure and build the necessary sense data.

It also changes bio_add_pc_page() to use 'rc' to make this slightly less confusing..

---
 drivers/target/target_core_pscsi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/target/target_core_pscsi.c +3 -3
index 6a31bed..7387350 100644
@@ -1057,7 +1057,7 @@ static int __pscsi_map_task_SG(
 	u32 data_len = task->task_size, i, len, bytes, off;
 	int nr_pages = (task->task_size + task_sg[0].offset +
 			PAGE_SIZE - 1) >> PAGE_SHIFT;
-	int nr_vecs = 0, ret = 0;
+	int nr_vecs = 0, rc, ret = PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES;
 	int rw = (TASK_CMD(task)->data_direction == DMA_TO_DEVICE);
 
 	if (!task->task_size)
@@ -1119,9 +1119,9 @@ static int __pscsi_map_task_SG(
 				" bio: %p page: %p len: %d off: %d\n", i, bio,
 				page, len, off);
 
-			ret = bio_add_pc_page(pdv->pdv_sd->request_queue,
+			rc = bio_add_pc_page(pdv->pdv_sd->request_queue,
 					bio, page, bytes, off);
-			if (ret != bytes)
+			if (rc != bytes)
 				goto fail;
 
 			DEBUG_PSCSI("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n",
Signature · 1 line
1.5.6.5