From: Artem Blagodarenko Date: Tue, 15 Sep 2015 10:32:14 +0000 (+0300) Subject: LU-7160 mgs: Skip processing .bak files on MGS X-Git-Tag: 2.8.57~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0bb49b2624827490ca3ea6a146d96cf7cf2b402f LU-7160 mgs: Skip processing .bak files on MGS lctl replace_nids command saves previous version of config files to file with original_name.bak file name. This file should never be processed by MGS. This patch adds code that skips file with .bak extention from list to be processed by MGS. Signed-off-by: Artem Blagodarenko Xyratex-bug-id: MRP-2742 Change-Id: I5ad5cf5548d395459d2245394ef3f7764fe8f0ca Reviewed-on: http://review.whamcloud.com/16428 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 2efea90..e307e16 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -100,6 +100,15 @@ int class_dentry_readdir(const struct lu_env *env, goto next; } + /* filter out ".bak" files */ + /* sizeof(".bak") - 1 == 3 */ + if (key_sz >= 3 && + !memcmp(".bak", key + key_sz - 3, 3)) { + CDEBUG(D_MGS, "Skipping backup file %.*s\n", + key_sz, key); + goto next; + } + de = mgs_direntry_alloc(key_sz + 1); if (de == NULL) { rc = -ENOMEM;