From 62d3b85f7d82bf7c76a84326a22b3139678f9d97 Mon Sep 17 00:00:00 2001 From: Emoly Liu Date: Thu, 13 Aug 2015 20:23:59 +0800 Subject: [PATCH] LU-6990 lproc: set parameter nosquash_nids correctly Fix the code to set parameter nosquash_nids correctly by echo command, no matter with "-n" option or not. Signed-off-by: Emoly Liu Change-Id: Ia4bf1ce32d76d4acd90aab5b799780e5e256cc29 Reviewed-on: http://review.whamcloud.com/15985 Reviewed-by: Bobi Jam Reviewed-by: Jian Yu Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/obdclass/lprocfs_status.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 4a51b73..a209153 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -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)) -- 1.8.3.1