diff mbox

nfs: don't lose MS_SYNCHRONOUS on remount of noac mount

Message ID 1303919349-30207-1-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton April 27, 2011, 3:49 p.m. UTC
On a remount, the VFS layer will clear the MS_SYNCHRONOUS bit on the
assumption that the flags on the mount syscall will have it set if the
remounted fs is supposed to keep it.

In the case of "noac" though, MS_SYNCHRONOUS is implied. A remount of
such a mount will lose the MS_SYNCHRONOUS flag since "sync" isn't part
of the mount options.

Reported-by: Max Matveev <makc@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/nfs/super.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Comments

Trond Myklebust April 27, 2011, 6:01 p.m. UTC | #1
On Wed, 2011-04-27 at 11:49 -0400, Jeff Layton wrote:
> On a remount, the VFS layer will clear the MS_SYNCHRONOUS bit on the
> assumption that the flags on the mount syscall will have it set if the
> remounted fs is supposed to keep it.
> 
> In the case of "noac" though, MS_SYNCHRONOUS is implied. A remount of
> such a mount will lose the MS_SYNCHRONOUS flag since "sync" isn't part
> of the mount options.
> 
> Reported-by: Max Matveev <makc@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>

Should this be 'Cc: stable@kernel.org'?
Jeff Layton April 27, 2011, 6:09 p.m. UTC | #2
On Wed, 27 Apr 2011 14:01:47 -0400
Trond Myklebust <Trond.Myklebust@netapp.com> wrote:

> On Wed, 2011-04-27 at 11:49 -0400, Jeff Layton wrote:
> > On a remount, the VFS layer will clear the MS_SYNCHRONOUS bit on the
> > assumption that the flags on the mount syscall will have it set if the
> > remounted fs is supposed to keep it.
> > 
> > In the case of "noac" though, MS_SYNCHRONOUS is implied. A remount of
> > such a mount will lose the MS_SYNCHRONOUS flag since "sync" isn't part
> > of the mount options.
> > 
> > Reported-by: Max Matveev <makc@redhat.com>
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> 
> Should this be 'Cc: stable@kernel.org'?

Yes, it wouldn't hurt. Not an extremely critical bug, but it's a
fairly straightforward fix. Can you add that, or would you rather I
resend?

Thanks,
diff mbox

Patch

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2b8e9a5..2f30297 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1976,6 +1976,15 @@  nfs_remount(struct super_block *sb, int *flags, char *raw_data)
 	if (error < 0)
 		goto out;
 
+	/*
+	 * noac is a special case. It implies -o sync, but that's not
+	 * necessarily reflected in the mtab options. do_remount_sb
+	 * will clear MS_SYNCHRONOUS if -o sync wasn't specified in the
+	 * remount options, so we have to explicitly reset it.
+	 */
+	if (data->flags & NFS_MOUNT_NOAC)
+		*flags |= MS_SYNCHRONOUS;
+
 	/* compare new mount options with old ones */
 	error = nfs_compare_remount_data(nfss, data);
 out: