linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Olga Kornievskaia <kolga@netapp.com>
Cc: linux-fsdevel@vger.kernel.org, hch@lst.de, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v1 1/3] fs: Don't copy beyond the end of the file
Date: Thu, 2 Mar 2017 10:40:57 -0800	[thread overview]
Message-ID: <20170302184057.GM26319@birch.djwong.org> (raw)
In-Reply-To: <9265113A-877D-4C62-9A3F-65D09D0FC404@netapp.com>

On Thu, Mar 02, 2017 at 01:21:49PM -0500, Olga Kornievskaia wrote:
> 
> > On Mar 2, 2017, at 11:58 AM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> > 
> > On Thu, Mar 02, 2017 at 11:02:09AM -0500, Olga Kornievskaia wrote:
> >> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >> 
> >> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >> ---
> >> fs/read_write.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >> 
> >> diff --git a/fs/read_write.c b/fs/read_write.c
> >> index 5816d4c..1d9e305 100644
> >> --- a/fs/read_write.c
> >> +++ b/fs/read_write.c
> >> @@ -1526,6 +1526,9 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
> >> 	if (unlikely(ret))
> >> 		return ret;
> >> 
> >> +	if (pos_in >= i_size_read(inode_in))
> >> +		return -EINVAL;
> >> +
> > 
> > This ought to go in vfs_clone_file_prep_inodes.
> > 
> > (He says, noticing that btrfs never got updated to use that validator…)
> 
> I apologize I’m not fully understanding the suggestion here. How btrfs is
> related to the check that I’m suggesting for the copy_file_range().  I don’t
> see how it would fix the problem for the copy_file_range().

Never mind, I misread vfs_copy as vfs_clone and thought you were talking
about something else. :(

Sorry about the noise.

--D

> Is the suggestion that NFS’s clone implementation is suppose to call
> vfs_clone_file_prep_inodes() where the check would be added and thus
> because vfs_copy_file_range() first decides to call clone() instead of
> copy() then that check would be met?
> 
> > 
> > --D
> > 
> >> 	if (!(file_in->f_mode & FMODE_READ) ||
> >> 	    !(file_out->f_mode & FMODE_WRITE) ||
> >> 	    (file_out->f_flags & O_APPEND))
> >> -- 
> >> 1.8.3.1
> >> 
> 

  reply	other threads:[~2017-03-02 18:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 16:02 [PATCH v1 0/3] VFS changes for NFSv4.2 "inter" server-to-server COPY op Olga Kornievskaia
2017-03-02 16:02 ` [PATCH v1 1/3] fs: Don't copy beyond the end of the file Olga Kornievskaia
2017-03-02 16:58   ` Darrick J. Wong
2017-03-02 18:21     ` Olga Kornievskaia
2017-03-02 18:40       ` Darrick J. Wong [this message]
2017-03-07 23:43         ` Christoph Hellwig
2017-03-07 23:46           ` Olga Kornievskaia
2017-03-07 23:50             ` Christoph Hellwig
2017-03-08 15:39               ` Olga Kornievskaia
2017-03-08 15:57                 ` Christoph Hellwig
2017-03-02 16:02 ` [PATCH v1 2/3] VFS permit cross device vfs_copy_file_range Olga Kornievskaia
2017-03-02 16:07   ` Christoph Hellwig
2017-03-02 16:38     ` Olga Kornievskaia
2017-03-07 20:35       ` Olga Kornievskaia
2017-03-15 18:09       ` J. Bruce Fields
2017-03-21 15:50         ` J. Bruce Fields
     [not found]           ` <56CDE406-AE24-40E4-852C-1C47C5CCD37E@netapp.com>
2017-03-21 19:03             ` J. Bruce Fields
2017-03-22 17:16               ` Olga Kornievskaia
2018-08-31 16:13   ` Florian Weimer
2018-08-31 16:25     ` Olga Kornievskaia
2018-08-31 22:56       ` Steve French
2017-03-02 16:02 ` [PATCH v1 3/3] VFS don't try clone if superblocks are different Olga Kornievskaia

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=20170302184057.GM26319@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=kolga@netapp.com \
    --cc=linux-fsdevel@vger.kernel.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).