Re: [PATCH] cifs: add support for FALLOC_FL_COLLAPSE_RANGE

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

 



On Tue, Mar 30, 2021 at 5:09 PM ronnie sahlberg
<ronniesahlberg@xxxxxxxxx> wrote:
>
> On Wed, Mar 31, 2021 at 12:22 AM Aurélien Aptel <aaptel@xxxxxxxx> wrote:
> >
> > Ronnie Sahlberg <lsahlber@xxxxxxxxxx> writes:
> > > +static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
> > > +                         loff_t off, loff_t len)
> > > +{
> > > +     int rc;
> > > +     unsigned int xid;
> > > +     struct cifsFileInfo *cfile = file->private_data;
> > > +     __le64 eof;
> > > +
> > > +     xid = get_xid();
> > > +
> > > +     if (off + len < off) {
> > > +             rc = -EFBIG;
> > > +             goto out;
> > > +     }
> >
> > loff_t is defined as 'long long' for me which is signed, and signed
> > overflow is Undefined Behaviour, unless we compile with -fwrapv which
> > I'm not sure it is something we can assume.
> >
> > Also, vfs_fallocate() in fs/open.c already does an overflow check before
> > calling f_op->falloc(), this is probably not needed. (It's also relying
> > on signed overflow so I guess it is ok...?)
>
> Thanks.
> Steve, can you drop this check from the patch?

Yes.   I was trying to run some xfstests on it vs. Windows with REFS
(and Samba with BTRFS after that).  Any observations on these two
patches and xfstests?

> > Rest of the patch looks good otherwise.
> >
> > Cheers,
> > --
> > Aurélien Aptel / SUSE Labs Samba Team




-- 
Thanks,

Steve




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

  Powered by Linux