From: Mark Fasheh <mfasheh@suse.com>
Date: Tue Dec  1 16:15:11 PST 2009
Subject: gfs2: allow spectator mounts for migration to ocfs2
Patch-mainline: never
References: FATE#307584

Lock out all writeable gfs2 mounts. This allows only spectator mounts, which
should never modify the disks. We do this to support minimal use of GFS2 for
migration of data. No performance bugs will be fixed. Any writeable mounts
are strictly prohibited.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>

---
 fs/gfs2/ops_fstype.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1134,6 +1134,19 @@ static int fill_super(struct super_block
 	}
 	sdp->sd_args = *args;
 
+	if (!sdp->sd_args.ar_spectator  || !(sb->s_flags & MS_RDONLY) ||
+	    sdp->sd_args.ar_ignore_local_fs) {
+		printk(KERN_WARNING "Only read-only GFS2 mounts are "
+		       "supported.\nPlease mount with the \"spectator\" and "
+		       "\"ro\" mount options\n");
+		goto fail;
+	}
+
+	printk(KERN_WARNING
+	       "WARNING: GFS2 mounts are ONLY supported for single-node "
+	       "migration of data!\nNo performance or write bugs will be "
+	       "considered.\n");
+
 	if (sdp->sd_args.ar_spectator) {
                 sb->s_flags |= MS_RDONLY;
 		set_bit(SDF_NORECOVERY, &sdp->sd_flags);
