cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Pierre Carrier <pcarrier@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] Handle multiple filesystems on a single mountpoint
Date: Mon, 23 Aug 2010 13:29:55 +0100	[thread overview]
Message-ID: <1282566595-2300-2-git-send-email-pcarrier@redhat.com> (raw)
In-Reply-To: <1282566595-2300-1-git-send-email-pcarrier@redhat.com>

Hello,


Here is a patch against gfs2-utils.git

Use-case:
When both a GFS and a GFS2 filesystems are mounted on the same mountpoint,
# umount /example
/sbin/umount.gfs2: /example is not a gfs2 filesystem
/sbin/umount.gfs: /example is not a gfs filesystem
/sbin/umount.gfs2: /example is not a gfs2 filesystem


Best regards,

-- 
Pierre
---
 gfs2/mount/util.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index 42cd8f0..06bdd2c 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -221,6 +221,7 @@ void read_proc_mounts(struct mount_options *mo)
 	char save_opts[PATH_MAX];
 	char save_device[PATH_MAX];
 	int found = 0;
+	unsigned int unexpected_type_found = 0;
 	struct stat st_mo_dev, st_mounts_dev;
 
 	file = fopen("/proc/mounts", "r");
@@ -244,8 +245,10 @@ void read_proc_mounts(struct mount_options *mo)
 			if (st_mo_dev.st_rdev != st_mounts_dev.st_rdev)
 				continue;
 		}
-		if (strcmp(type, fsname))
-			die("%s is not a %s filesystem\n", mo->dir, fsname);
+		if (strcmp(type, fsname)) {
+			unexpected_type_found++;
+			continue;
+		}
 
 		/* when there is an input dev specified (mount), we should get
 		   only one matching line; when there is no input dev specified
@@ -256,6 +259,13 @@ void read_proc_mounts(struct mount_options *mo)
 		strncpy(save_line, line, PATH_MAX);
 		found = 1;
 	}
+	
+	if(!found) {
+		if(unexpected_type_found)
+		die("Only %u non-%s filesystems found on %s\n",
+		    unexpected_type_found, fsname, mo->dir);
+		die("%s is not a %s filesystem\n", mo->dir, fsname);
+	}
 
 	fclose(file);
 
-- 
1.7.2.1



      reply	other threads:[~2010-08-23 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 12:29 [Cluster-devel] [PATCH] Handle multiple filesystems on a single mountpoint Pierre Carrier
2010-08-23 12:29 ` Pierre Carrier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282566595-2300-2-git-send-email-pcarrier@redhat.com \
    --to=pcarrier@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).