linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSD: fix wrong mnt_writer count in rename (MMOTM 2007-11-10-19-05)
@ 2007-11-13  1:15 Erez Zadok
  2007-11-13 17:39 ` Dave Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Erez Zadok @ 2007-11-13  1:15 UTC (permalink / raw)
  To: bfields, Dave Hansen, Andrew Morton; +Cc: linux-kernel, nfs

NFSD forgets to call mnt_drop_write after a successful rename.  Here's a
fix.  (Ah, the curse of a stackable file system developer: you have to debug
everyone else's too. :-)

One thing I wasn't sure is whether I could move the mnt_drop_write line a
little above, just after the call to vfs_rename.  If we can drop the ref
earlier, it could improve scalability/performance just a bit, no? (i.e.,
what are the ramifications of holding on to this mnt writer ref longer than
needed?)

Cheers,
Erez.



Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7dfde65..47aec49 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1693,6 +1693,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
 		if (!host_err)
 			host_err = nfsd_sync_dir(fdentry);
 	}
+	mnt_drop_write(ffhp->fh_export->ex_path.mnt);
 
  out_dput_new:
 	dput(ndentry);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFSD: fix wrong mnt_writer count in rename (MMOTM 2007-11-10-19-05)
  2007-11-13  1:15 [PATCH] NFSD: fix wrong mnt_writer count in rename (MMOTM 2007-11-10-19-05) Erez Zadok
@ 2007-11-13 17:39 ` Dave Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2007-11-13 17:39 UTC (permalink / raw)
  To: Erez Zadok; +Cc: bfields, Andrew Morton, linux-kernel, nfs

On Mon, 2007-11-12 at 20:15 -0500, Erez Zadok wrote:
> NFSD forgets to call mnt_drop_write after a successful rename.  Here's a
> fix.  (Ah, the curse of a stackable file system developer: you have to debug
> everyone else's too. :-)
> 
> One thing I wasn't sure is whether I could move the mnt_drop_write line a
> little above, just after the call to vfs_rename.  If we can drop the ref
> earlier, it could improve scalability/performance just a bit, no? (i.e.,
> what are the ramifications of holding on to this mnt writer ref longer than
> needed?)

I do see some write-ish things happening inside of the nfsd_sync_dir()
call chain: the fsync() and filemap_fdatawrite().

The danger here is that the moment you mnt_drop_write(), the filesystem
is mounted r/o by someone else, then those fsync() writes occur when
everyone thinks it is r/o.  So, I think your fix is the most
conservative, and the most correct.

> Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
> 
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 7dfde65..47aec49 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1693,6 +1693,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
>  		if (!host_err)
>  			host_err = nfsd_sync_dir(fdentry);
>  	}
> +	mnt_drop_write(ffhp->fh_export->ex_path.mnt);
> 
>   out_dput_new:
>  	dput(ndentry);

Otherwise, looks good to me.  Thanks.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>

-- Dave


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-13 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-13  1:15 [PATCH] NFSD: fix wrong mnt_writer count in rename (MMOTM 2007-11-10-19-05) Erez Zadok
2007-11-13 17:39 ` Dave Hansen

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).