diff options
author | Andy Grover <agrover@redhat.com> | 2013-05-29 15:05:59 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-06-20 19:47:32 -0400 |
commit | 58bd0c69ffa27ea2309959836811e88004d73720 (patch) | |
tree | 5828e17a3a7708e55b511e88affeea0f3172a9ef /drivers/target/iscsi/iscsi_target_configfs.c | |
parent | b5aff3d2747bea08b386edd070941a45611ffe51 (diff) |
target/iscsi: Fix op=disable + error handling cases in np_store_iser
Writing 0 when iser was not previously enabled, so succeed but do
nothing so that user-space code doesn't need a try: catch block
when ib_isert logic is not available.
Also, return actual error from add_network_portal using PTR_ERR
during op=enable failure.
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_configfs.c')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 13e9e715ad2e..fe4a5a20c75c 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -155,7 +155,7 @@ static ssize_t lio_target_np_store_iser( | |||
155 | struct iscsi_tpg_np *tpg_np_iser = NULL; | 155 | struct iscsi_tpg_np *tpg_np_iser = NULL; |
156 | char *endptr; | 156 | char *endptr; |
157 | u32 op; | 157 | u32 op; |
158 | int rc; | 158 | int rc = 0; |
159 | 159 | ||
160 | op = simple_strtoul(page, &endptr, 0); | 160 | op = simple_strtoul(page, &endptr, 0); |
161 | if ((op != 1) && (op != 0)) { | 161 | if ((op != 1) && (op != 0)) { |
@@ -174,22 +174,25 @@ static ssize_t lio_target_np_store_iser( | |||
174 | return -EINVAL; | 174 | return -EINVAL; |
175 | 175 | ||
176 | if (op) { | 176 | if (op) { |
177 | int rc = request_module("ib_isert"); | 177 | rc = request_module("ib_isert"); |
178 | if (rc != 0) | 178 | if (rc != 0) { |
179 | pr_warn("Unable to request_module for ib_isert\n"); | 179 | pr_warn("Unable to request_module for ib_isert\n"); |
180 | rc = 0; | ||
181 | } | ||
180 | 182 | ||
181 | tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, | 183 | tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, |
182 | np->np_ip, tpg_np, ISCSI_INFINIBAND); | 184 | np->np_ip, tpg_np, ISCSI_INFINIBAND); |
183 | if (!tpg_np_iser || IS_ERR(tpg_np_iser)) | 185 | if (IS_ERR(tpg_np_iser)) { |
186 | rc = PTR_ERR(tpg_np_iser); | ||
184 | goto out; | 187 | goto out; |
188 | } | ||
185 | } else { | 189 | } else { |
186 | tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); | 190 | tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); |
187 | if (!tpg_np_iser) | 191 | if (tpg_np_iser) { |
188 | goto out; | 192 | rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); |
189 | 193 | if (rc < 0) | |
190 | rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); | 194 | goto out; |
191 | if (rc < 0) | 195 | } |
192 | goto out; | ||
193 | } | 196 | } |
194 | 197 | ||
195 | printk("lio_target_np_store_iser() done, op: %d\n", op); | 198 | printk("lio_target_np_store_iser() done, op: %d\n", op); |
@@ -198,7 +201,7 @@ static ssize_t lio_target_np_store_iser( | |||
198 | return count; | 201 | return count; |
199 | out: | 202 | out: |
200 | iscsit_put_tpg(tpg); | 203 | iscsit_put_tpg(tpg); |
201 | return -EINVAL; | 204 | return rc; |
202 | } | 205 | } |
203 | 206 | ||
204 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); | 207 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); |