From ab19608677cb27d01415aea4fc61c991ab6e0ca5 Mon Sep 17 00:00:00 2001 From: Nathan Rutman Date: Wed, 13 Jan 2010 09:58:56 -0800 Subject: [PATCH] b=21746 compare full fsname when erasing config files for writeconf i=breitz i=brian --- lustre/mgs/mgs_llog.c | 12 +++++++++--- lustre/obdclass/obd_mount.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 1f174b5..5b8d038 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -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)); } diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 3afdd26..c75a69c 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -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); -- 1.8.3.1