From: "J. Bruce Fields" <bfields@fieldses.org>
To: Anna Schumaker <Anna.Schumaker@netapp.com>
Cc: linux-nfs@vger.kernel.org, Trond.Myklebust@primarydata.com,
hch@infradead.org
Subject: Re: [PATCH v3 3/3] NFSD: Implement the COPY call
Date: Tue, 15 Mar 2016 10:46:37 -0400 [thread overview]
Message-ID: <20160315144637.GC419@fieldses.org> (raw)
In-Reply-To: <20160314213426.GC22276@fieldses.org>
On Mon, Mar 14, 2016 at 05:34:26PM -0400, J. Bruce Fields wrote:
> On Tue, Mar 08, 2016 at 04:55:57PM -0500, Anna Schumaker wrote:
> > From: Anna Schumaker <Anna.Schumaker@netapp.com>
> > static __be32
> > +nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> > + struct nfsd4_copy *copy)
> > +{
> > + struct file *src, *dst;
> > + __be32 status;
> > + ssize_t bytes;
> > + loff_t max;
> > +
> > + status = nfsd4_verify_copy(rqstp, cstate, ©->cp_src_stateid, &src,
> > + ©->cp_dst_stateid, &dst);
> > + if (status)
> > + goto out;
> > +
> > + max = i_size_read(file_inode(src));
> > + if ((copy->cp_src_pos + copy->cp_count) > max) {
> > + status = nfserr_inval;
> > + goto out_put;
> > + }
>
> If we care about the race between this check and the copy, then we need
> some locking. If we don't, then a comment explaining why not would be
> useful here.
>
> (Looks like this check, and the INVAL error, are both mandated by the
> spec. The behavior looks wrong to me--usually EINVAL's reserved for
> things the client had to know was a problem, but here the client doesn't
> necessarily know the file size. I would have expected just success and
> a short read.)
Now that I look at it, that behavior's what's documented for the system
call too; from the man page:
EINVAL Requested range extends beyond the end of the source
file; or the flags argument is not 0.
Still seems like really strange behavior to me.
But if that's what we chose, then I think vfs_copy_range should be doing
that check for us.
--b.
next prev parent reply other threads:[~2016-03-15 14:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 21:55 [PATCH v3 0/3] NFSv4.2: Add support for the COPY operation Anna Schumaker
2016-03-08 21:55 ` [PATCH v3 1/3] NFS: Add nfs_commit_file() Anna Schumaker
2016-03-08 21:55 ` [PATCH v3 2/3] NFS: Add COPY nfs operation Anna Schumaker
2016-03-08 21:55 ` [PATCH v3 3/3] NFSD: Implement the COPY call Anna Schumaker
2016-03-14 21:34 ` J. Bruce Fields
2016-03-15 14:46 ` J. Bruce Fields [this message]
2016-03-08 21:55 ` [PATCH v3 4/3] vfs_copy_range() test program Anna Schumaker
2016-03-15 8:15 ` Christoph Hellwig
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=20160315144637.GC419@fieldses.org \
--to=bfields@fieldses.org \
--cc=Anna.Schumaker@netapp.com \
--cc=Trond.Myklebust@primarydata.com \
--cc=hch@infradead.org \
--cc=linux-nfs@vger.kernel.org \
/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).