Whamcloud - gitweb
b=21746 compare full fsname when erasing config files for writeconf
authorNathan Rutman <nathan.rutman@sun.com>
Wed, 13 Jan 2010 17:58:56 +0000 (09:58 -0800)
committerJohann Lombardi <johann@sun.com>
Wed, 13 Jan 2010 21:50:28 +0000 (22:50 +0100)
i=breitz
i=brian

lustre/mgs/mgs_llog.c
lustre/obdclass/obd_mount.c

index 1f174b5..5b8d038 100644 (file)
@@ -1892,6 +1892,7 @@ int mgs_erase_logs(struct obd_device *obd, char *fsname)
         struct list_head dentry_list;
         struct l_linux_dirent *dirent, *n;
         int rc, len = strlen(fsname);
+        char *suffix;
         ENTRY;
 
         /* Find all the logs in the CONFIGS directory */
@@ -1911,9 +1912,14 @@ int mgs_erase_logs(struct obd_device *obd, char *fsname)
 
         list_for_each_entry_safe(dirent, n, &dentry_list, lld_list) {
                 list_del(&dirent->lld_list);
-                if (strncmp(fsname, dirent->lld_name, len) == 0) {
-                        CDEBUG(D_MGS, "Removing log %s\n", dirent->lld_name);
-                        mgs_erase_log(obd, dirent->lld_name);
+                suffix = strrchr(dirent->lld_name, '-');
+                if (suffix != NULL) {
+                        if ((len == suffix - dirent->lld_name) &&
+                            (strncmp(fsname, dirent->lld_name, len) == 0)) {
+                                CDEBUG(D_MGS, "Removing log %s\n",
+                                       dirent->lld_name);
+                                mgs_erase_log(obd, dirent->lld_name);
+                        }
                 }
                 OBD_FREE(dirent, sizeof(*dirent));
         }
index 3afdd26..c75a69c 100644 (file)
@@ -1690,7 +1690,7 @@ int server_name2index(char *svname, __u32 *idx, char **endptr)
 {
         unsigned long index;
         int rc;
-        char *dash = strchr(svname, '-');
+        char *dash = strrchr(svname, '-');
         if (!dash)
                 return(-EINVAL);