Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andy Grover and committed by
Nicholas Bellinger
58bd0c69 b5aff3d2

+14 -11
+14 -11
drivers/target/iscsi/iscsi_target_configfs.c
··· 155 155 struct iscsi_tpg_np *tpg_np_iser = NULL; 156 156 char *endptr; 157 157 u32 op; 158 - int rc; 158 + int rc = 0; 159 159 160 160 op = simple_strtoul(page, &endptr, 0); 161 161 if ((op != 1) && (op != 0)) { ··· 174 174 return -EINVAL; 175 175 176 176 if (op) { 177 - int rc = request_module("ib_isert"); 178 - if (rc != 0) 177 + rc = request_module("ib_isert"); 178 + if (rc != 0) { 179 179 pr_warn("Unable to request_module for ib_isert\n"); 180 + rc = 0; 181 + } 180 182 181 183 tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, 182 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 187 goto out; 188 + } 185 189 } else { 186 190 tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); 187 - if (!tpg_np_iser) 188 - goto out; 189 - 190 - rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); 191 - if (rc < 0) 192 - goto out; 191 + if (tpg_np_iser) { 192 + rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); 193 + if (rc < 0) 194 + goto out; 195 + } 193 196 } 194 197 195 198 printk("lio_target_np_store_iser() done, op: %d\n", op); ··· 201 198 return count; 202 199 out: 203 200 iscsit_put_tpg(tpg); 204 - return -EINVAL; 201 + return rc; 205 202 } 206 203 207 204 TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR);