Whamcloud - gitweb
LU-7160 mgs: Skip processing .bak files on MGS 28/16428/7
authorArtem Blagodarenko <artem.blagodarenko@seagate.com>
Tue, 15 Sep 2015 10:32:14 +0000 (13:32 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 22 Aug 2016 03:45:43 +0000 (03:45 +0000)
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 <artem.blagodarenko@seagate.com>
Xyratex-bug-id: MRP-2742
Change-Id: I5ad5cf5548d395459d2245394ef3f7764fe8f0ca
Reviewed-on: http://review.whamcloud.com/16428
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mgs/mgs_llog.c

index 2efea90..e307e16 100644 (file)
@@ -100,6 +100,15 @@ int class_dentry_readdir(const struct lu_env *env,
                                goto next;
                }
 
                                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;
                de = mgs_direntry_alloc(key_sz + 1);
                if (de == NULL) {
                        rc = -ENOMEM;