Re: [PATCH v3] CIFS: check new file size when extending file by fallocate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I also see (in cifs-2.6.git for-next)

commit 0667059d0b4ad231e7258aa571f28574b313f34f
Author: Murphy Zhou <jencce.kernel@xxxxxxxxx>
Date:   Fri Feb 21 10:30:01 2020 +0800

    cifs: allow unlock flock and OFD lock across fork

    Since commit d0677992d2af ("cifs: add support for flock") added
    support for flock, LTP/flock03[1] testcase started to fail.

On Sun, Mar 22, 2020 at 7:24 PM Murphy Zhou <jencce.kernel@xxxxxxxxx> wrote:
>
> Hi Steve,
>
> On Wed, Mar 18, 2020 at 10:36:54PM -0500, Steve French wrote:
> > Merged into cifs-2.6.git for-next
>
> I don't see this in for-next. Is it for 5.7?
>
> So does this one:
> cifs: allow unlock flock and OFD lock across fork
>
> Thanks!
> >
> > On Wed, Mar 18, 2020, 07:48 Murphy Zhou <jencce.kernel@xxxxxxxxx> wrote:
> >
> > > xfstests generic/228 checks if fallocate respect RLIMIT_FSIZE.
> > > After fallocate mode 0 extending enabled, we can hit this failure.
> > > Fix this by check the new file size with vfs helper, return
> > > error if file size is larger then RLIMIT_FSIZE(ulimit -f).
> > >
> > > This patch has been tested by LTP/xfstests aginst samba and
> > > Windows server.
> > >
> > > Acked-by: ronnie sahlberg <ronniesahlberg@xxxxxxxxx>
> > > Signed-off-by: Murphy Zhou <jencce.kernel@xxxxxxxxx>
> > > ---
> > >
> > > v2:
> > >   Use (off+len) instead of eof for correct argument type.
> > > v3:
> > >   Fix Ronnie's email address.
> > >
> > >  fs/cifs/smb2ops.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> > > index c31e84ee3c39..f221a01f62bd 100644
> > > --- a/fs/cifs/smb2ops.c
> > > +++ b/fs/cifs/smb2ops.c
> > > @@ -3246,6 +3246,10 @@ static long smb3_simple_falloc(struct file *file,
> > > struct cifs_tcon *tcon,
> > >          * Extending the file
> > >          */
> > >         if ((keep_size == false) && i_size_read(inode) < off + len) {
> > > +               rc = inode_newsize_ok(inode, off + len);
> > > +               if (rc)
> > > +                       goto out;
> > > +
> > >                 if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0)
> > >                         smb2_set_sparse(xid, tcon, cfile, inode, false);
> > >
> > > --
> > > 2.20.1
> > >
> > >
>
> --
> Murphy



-- 
Thanks,

Steve



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux