From 3e9818c943577b4ee99f5d4d4ce21afeb348bd4a Mon Sep 17 00:00:00 2001
From: bobijam <bobijam>
Date: Fri, 12 Sep 2008 01:37:21 +0000
Subject: [PATCH] Branch HEAD b=17043 o=nikita.danilov i=adilger i=zhenyu.xu
 (bobijam)

mount.lustre: match both host name and nid against mount table.
---
 lustre/utils/mount_lustre.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c
index 0dd13c61a3..0e082468d0 100644
--- a/lustre/utils/mount_lustre.c
+++ b/lustre/utils/mount_lustre.c
@@ -97,7 +97,7 @@ void usage(FILE *out)
         exit((out != stdout) ? EINVAL : 0);
 }
 
-static int check_mtab_entry(char *spec, char *mtpt, char *type)
+static int check_mtab_entry(char *spec1, char *spec2, char *mtpt, char *type)
 {
         FILE *fp;
         struct mntent *mnt;
@@ -107,7 +107,8 @@ static int check_mtab_entry(char *spec, char *mtpt, char *type)
                 return(0);
 
         while ((mnt = getmntent(fp)) != NULL) {
-                if (strcmp(mnt->mnt_fsname, spec) == 0 &&
+                if ((strcmp(mnt->mnt_fsname, spec1) == 0 ||
+                     strcmp(mnt->mnt_fsname, spec2) == 0) &&
                         strcmp(mnt->mnt_dir, mtpt) == 0 &&
                         strcmp(mnt->mnt_type, type) == 0) {
                         endmntent(fp);
@@ -544,7 +545,7 @@ int main(int argc, char *const argv[])
         }
 
         if (!force) {
-                rc = check_mtab_entry(usource, target, "lustre");
+                rc = check_mtab_entry(usource, source, target, "lustre");
                 if (rc && !(flags & MS_REMOUNT)) {
                         fprintf(stderr, "%s: according to %s %s is "
                                 "already mounted on %s\n",
-- 
GitLab