linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kent Overstreet <koverstreet@google.com>
Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Zach Brown <zab@redhat.com>
Subject: Re: [PATCH] nfsd: fix bad offset use
Date: Fri, 22 Mar 2013 16:53:53 -0400	[thread overview]
Message-ID: <20130322205353.GA14438@fieldses.org> (raw)
In-Reply-To: <1363976304-26093-1-git-send-email-koverstreet@google.com>

On Fri, Mar 22, 2013 at 11:18:24AM -0700, Kent Overstreet wrote:
> vfs_writev() updates the offset argument - but the code then passes the
> offset to vfs_fsync_range(). Since offset now points to the offset after
> what was just written, this is probably not what was intended

Whoops--thanks!  Looks like this was introduced by my
face15025ffdf664de95e86ae831544154d26c9c "nfsd: use vfs_fsync_range(),
not O_SYNC, for stable writes", in 3.8.

I'll queue up for 3.9 and stable.

--b.

> 
> Signed-off-by: Kent Overstreet <koverstreet@google.com>
> Cc: "J. Bruce Fields" <bfields@fieldses.org>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
> Cc: Zach Brown <zab@redhat.com>
> ---
>  fs/nfsd/vfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 2a7eb53..2b2e239 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1013,6 +1013,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
>  	int			host_err;
>  	int			stable = *stablep;
>  	int			use_wgather;
> +	loff_t			pos = offset;
>  
>  	dentry = file->f_path.dentry;
>  	inode = dentry->d_inode;
> @@ -1025,7 +1026,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
>  
>  	/* Write the data. */
>  	oldfs = get_fs(); set_fs(KERNEL_DS);
> -	host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset);
> +	host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos);
>  	set_fs(oldfs);
>  	if (host_err < 0)
>  		goto out_nfserr;
> -- 
> 1.8.1.3
> 

  parent reply	other threads:[~2013-03-22 20:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 18:18 [PATCH] nfsd: fix bad offset use Kent Overstreet
2013-03-22 19:14 ` Zach Brown
2013-03-22 20:53 ` J. Bruce Fields [this message]
2013-03-22 20:54   ` J. Bruce Fields
2013-03-22 21:21     ` Kent Overstreet

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=20130322205353.GA14438@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=ebiederm@xmission.com \
    --cc=koverstreet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zab@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).