Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > main-testing-src > by-pkgid > cb05b7fc08376cb978d1fb10fd4008d1 > files > 9

nfs-utils-1.2.2-5mdv2010.1.src.rpm

From: Chuck Lever <chuck.lever@oracle.com>
Date: Thu, 16 Sep 2010 11:28:18 +0000 (-0400)
Subject: mount.nfs: Don't do anything fancy if this is a remount
X-Git-Tag: nfs-utils-1-2-3-rc6~13
X-Git-Url: http://git.linux-nfs.org/?p=steved%2Fnfs-utils.git;a=commitdiff_plain;h=a88c279992f4b63e3dcaac9930e300fd4bb03dd7;hp=6f73daf5a5711dc0620f7d43c61c4fd57c0d3f80

mount.nfs: Don't do anything fancy if this is a remount

We don't want to append "vers=4" or perform any negotiation if the
"remount" mount option was specified.  It will just end in tears.

This attempts to address

  https://qa.mandriva.com/show_bug.cgi?id=60311

and

  https://bugzilla.linux-nfs.org/show_bug.cgi?id=187

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index c5c4ba1..50a1a2a 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -967,6 +967,26 @@ static int nfsmount_bg(struct nfsmount_info *mi)
 }
 
 /*
+ * Usually all that is needed for an NFS remount is to change
+ * generic mount options like "sync" or "ro".  These generic
+ * options are controlled by mi->flags, not by text-based
+ * options, and no contact with the server is needed.
+ *
+ * Take care with the /etc/mtab entry for this mount; just
+ * calling update_mtab() will change an "-t nfs -o vers=4"
+ * mount to an "-t nfs -o remount" mount, and that will
+ * confuse umount.nfs.
+ *
+ * Returns a valid mount command exit code.
+ */
+static int nfs_remount(struct nfsmount_info *mi)
+{
+	if (nfs_sys_mount(mi, mi->options))
+		return EX_SUCCESS;
+	return EX_FAIL;
+}
+
+/*
  * Process mount options and try a mount system call.
  *
  * Returns a valid mount command exit code.
@@ -982,6 +1002,12 @@ static int nfsmount_start(struct nfsmount_info *mi)
 	if (!nfs_validate_options(mi))
 		return EX_FAIL;
 
+	/*
+	 * Avoid retry and negotiation logic when remounting
+	 */
+	if (mi->flags & MS_REMOUNT)
+		return nfs_remount(mi);
+
 	if (po_rightmost(mi->options, nfs_background_opttbl) == 0)
 		return nfsmount_bg(mi);
 	else
@@ -998,6 +1024,8 @@ static int nfsmount_start(struct nfsmount_info *mi)
  *		(input and output argument)
  * @fake: flag indicating whether to carry out the whole operation
  * @child: one if this is a mount daemon (bg)
+ *
+ * Returns a valid mount command exit code.
  */
 int nfsmount_string(const char *spec, const char *node, const char *type,
 		    int flags, char **extra_opts, int fake, int child)