Whamcloud - gitweb
LU-6990 lproc: set parameter nosquash_nids correctly 85/15985/2
authorEmoly Liu <emoly.liu@intel.com>
Thu, 13 Aug 2015 12:23:59 +0000 (20:23 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Aug 2015 15:52:32 +0000 (15:52 +0000)
Fix the code to set parameter nosquash_nids correctly by echo command,
no matter with "-n" option or not.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Change-Id: Ia4bf1ce32d76d4acd90aab5b799780e5e256cc29
Reviewed-on: http://review.whamcloud.com/15985
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/lprocfs_status.c

index 4a51b73..a209153 100644 (file)
@@ -1923,6 +1923,7 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
        char *kernbuf = NULL;
        char *errmsg;
        struct list_head tmp;
+       int len = count;
        ENTRY;
 
        if (count > 4096) {
@@ -1942,9 +1943,10 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
        kernbuf[count] = '\0';
 
        if (count > 0 && kernbuf[count - 1] == '\n')
-               kernbuf[count - 1] = '\0';
+               len = count - 1;
 
-       if (strcmp(kernbuf, "NONE") == 0 || strcmp(kernbuf, "clear") == 0) {
+       if ((len == 4 && strncmp(kernbuf, "NONE", len) == 0) ||
+           (len == 5 && strncmp(kernbuf, "clear", len) == 0)) {
                /* empty string is special case */
                down_write(&squash->rsi_sem);
                if (!list_empty(&squash->rsi_nosquash_nids))