iscsi-target: Return error if unable to add network portal
authorVarun Prakash <varun@chelsio.com>
Sun, 11 Dec 2016 16:35:56 +0000 (22:05 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Jan 2017 07:21:54 +0000 (08:21 +0100)
commitde8a06c673ac38e9f76fb97a6ffe48034d9ba6b8
tree2c19f04977f916a7e01341616380bbb613463ce0
parent9c3928be0dbac79a2f5c340e2ea829b296f8a946
iscsi-target: Return error if unable to add network portal

commit 83337e544323a8bd7492994d64af339175ac7107 upstream.

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")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/iscsi/iscsi_target_configfs.c