瀏覽代碼

iscsi-target: Return error if unable to add network portal

If iscsit_tpg_add_network_portal() fails then
return error code instead of 0 to user space.

If iscsi-target returns 0 then user space keeps
on retrying same command infinitely, targetcli or
echo hangs till command completes with non zero
return value. In some cases it is possible that
add network portal command never completes with
success even after retrying multiple times,
for example - cxgbit_setup_np() always returns
-EINVAL if portal IP does not belong to Chelsio
adapter interface.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
[ bvanassche: Added "Fixes:" and "Cc: stable" tags ]
Fixes: commit d4b3fa4b0881 ("iscsi-target: Make iscsi_tpg_np driver show/store use generic code")
Cc: <stable@vger.kernel.org>
Varun Prakash 8 年之前
父節點
當前提交
83337e5443
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      drivers/target/iscsi/iscsi_target_configfs.c

+ 3 - 1
drivers/target/iscsi/iscsi_target_configfs.c

@@ -101,8 +101,10 @@ static ssize_t lio_target_np_driver_store(struct config_item *item,
 
 
 		tpg_np_new = iscsit_tpg_add_network_portal(tpg,
 		tpg_np_new = iscsit_tpg_add_network_portal(tpg,
 					&np->np_sockaddr, tpg_np, type);
 					&np->np_sockaddr, tpg_np, type);
-		if (IS_ERR(tpg_np_new))
+		if (IS_ERR(tpg_np_new)) {
+			rc = PTR_ERR(tpg_np_new);
 			goto out;
 			goto out;
+		}
 	} else {
 	} else {
 		tpg_np_new = iscsit_tpg_locate_child_np(tpg_np, type);
 		tpg_np_new = iscsit_tpg_locate_child_np(tpg_np, type);
 		if (tpg_np_new) {
 		if (tpg_np_new) {