Whamcloud - gitweb
LU-12094 ptlrpc: protect obd_import in lprocfs_import_seq_write 53/35853/3
authorJames Simmons <jsimmons@infradead.org>
Thu, 22 Aug 2019 23:52:12 +0000 (19:52 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Sep 2019 01:53:24 +0000 (01:53 +0000)
The obd_import can disappear so take the cl_sem to protect it.

Change-Id: I36f2c4c606a0470781a692631265938848173f8b
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/35853
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/lproc_ptlrpc.c

index 546aa3c..f2d747a 100644 (file)
@@ -1378,6 +1378,8 @@ lprocfs_import_seq_write(struct file *file, const char __user *buffer,
        if (strncmp(prefix, kbuf, prefix_len) != 0)
                GOTO(out, count = -EINVAL);
 
        if (strncmp(prefix, kbuf, prefix_len) != 0)
                GOTO(out, count = -EINVAL);
 
+       LPROCFS_CLIMP_CHECK(obd);
+
        uuid = kbuf + prefix_len;
        ptr = strstr(uuid, "::");
        if (ptr) {
        uuid = kbuf + prefix_len;
        ptr = strstr(uuid, "::");
        if (ptr) {
@@ -1403,6 +1405,7 @@ lprocfs_import_seq_write(struct file *file, const char __user *buffer,
                }
        }
 
                }
        }
 
+       LPROCFS_CLIMP_EXIT(obd);
        if (do_reconn)
                ptlrpc_recover_import(imp, uuid, 1);
 
        if (do_reconn)
                ptlrpc_recover_import(imp, uuid, 1);