* [PATCH v3] CIFS: check new file size when extending file by fallocate
@ 2020-03-18 12:46 Murphy Zhou
[not found] ` <CAH2r5muTx3DmGZ+ZedrNmPK8ZHq10XZ3RXxVD0H6RmEcBvnVPQ@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Murphy Zhou @ 2020-03-18 12:46 UTC (permalink / raw)
To: CIFS; +Cc: Ronnie Sahlberg, Steve French
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@gmail.com>
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] CIFS: check new file size when extending file by fallocate
[not found] ` <CAH2r5muTx3DmGZ+ZedrNmPK8ZHq10XZ3RXxVD0H6RmEcBvnVPQ@mail.gmail.com>
@ 2020-03-23 0:24 ` Murphy Zhou
2020-03-23 3:36 ` Steve French
2020-03-23 3:51 ` Steve French
0 siblings, 2 replies; 6+ messages in thread
From: Murphy Zhou @ 2020-03-23 0:24 UTC (permalink / raw)
To: Steve French; +Cc: Murphy Zhou, CIFS, Ronnie Sahlberg, Steve French
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@gmail.com> 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@gmail.com>
> > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> > ---
> >
> > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] CIFS: check new file size when extending file by fallocate
2020-03-23 0:24 ` Murphy Zhou
@ 2020-03-23 3:36 ` Steve French
2020-03-23 3:51 ` Steve French
1 sibling, 0 replies; 6+ messages in thread
From: Steve French @ 2020-03-23 3:36 UTC (permalink / raw)
To: Murphy Zhou; +Cc: CIFS, Ronnie Sahlberg, Steve French
Isn't this it: https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=4f6257b7d092b84ba8a62769ad6c6fb6ebe89d70
It has been in there 4 days (although I will be updating the branch soon)
CIFS: check new file size when extending file by fallocate
authorMurphy Zhou <jencce.kernel@gmail.com>
Wed, 18 Mar 2020 07:43:38 -0500 (20:43 +0800)
committerSteve French <stfrench@microsoft.com>
Wed, 18 Mar 2020 16:28:10 -0500 (16:28 -0500)
commit4f6257b7d092b84ba8a62769ad6c6fb6ebe89d70
tree7faad4e1799cf4bbb3287c8cb93c9fe6cf8ffabf
On Sun, Mar 22, 2020 at 7:24 PM Murphy Zhou <jencce.kernel@gmail.com> 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@gmail.com> 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@gmail.com>
> > > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> > > ---
> > >
> > > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] CIFS: check new file size when extending file by fallocate
2020-03-23 0:24 ` Murphy Zhou
2020-03-23 3:36 ` Steve French
@ 2020-03-23 3:51 ` Steve French
2020-03-23 3:52 ` Steve French
1 sibling, 1 reply; 6+ messages in thread
From: Steve French @ 2020-03-23 3:51 UTC (permalink / raw)
To: Murphy Zhou; +Cc: CIFS, Ronnie Sahlberg, Steve French
I also see (in cifs-2.6.git for-next)
commit 0667059d0b4ad231e7258aa571f28574b313f34f
Author: Murphy Zhou <jencce.kernel@gmail.com>
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@gmail.com> 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@gmail.com> 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@gmail.com>
> > > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> > > ---
> > >
> > > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] CIFS: check new file size when extending file by fallocate
2020-03-23 3:51 ` Steve French
@ 2020-03-23 3:52 ` Steve French
2020-03-23 5:13 ` Murphy Zhou
0 siblings, 1 reply; 6+ messages in thread
From: Steve French @ 2020-03-23 3:52 UTC (permalink / raw)
To: Murphy Zhou; +Cc: CIFS, Ronnie Sahlberg, Steve French
If you see any patches missing for 5.7 in for-next (or any urgent
patches missing needed for 5.6) let me know ASAP
On Sun, Mar 22, 2020 at 10:51 PM Steve French <smfrench@gmail.com> wrote:
>
> I also see (in cifs-2.6.git for-next)
>
> commit 0667059d0b4ad231e7258aa571f28574b313f34f
> Author: Murphy Zhou <jencce.kernel@gmail.com>
> 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@gmail.com> 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@gmail.com> 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@gmail.com>
> > > > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> > > > ---
> > > >
> > > > 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
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] CIFS: check new file size when extending file by fallocate
2020-03-23 3:52 ` Steve French
@ 2020-03-23 5:13 ` Murphy Zhou
0 siblings, 0 replies; 6+ messages in thread
From: Murphy Zhou @ 2020-03-23 5:13 UTC (permalink / raw)
To: Steve French; +Cc: Murphy Zhou, CIFS, Steve French
On Sun, Mar 22, 2020 at 10:52:27PM -0500, Steve French wrote:
> If you see any patches missing for 5.7 in for-next (or any urgent
> patches missing needed for 5.6) let me know ASAP
Oh sorry I was checking the github url.. Updated.
Now I see it's all good. No patch is missing.
Thanks!
>
> On Sun, Mar 22, 2020 at 10:51 PM Steve French <smfrench@gmail.com> wrote:
> >
> > I also see (in cifs-2.6.git for-next)
> >
> > commit 0667059d0b4ad231e7258aa571f28574b313f34f
> > Author: Murphy Zhou <jencce.kernel@gmail.com>
> > 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@gmail.com> 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@gmail.com> 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@gmail.com>
> > > > > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> > > > > ---
> > > > >
> > > > > 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
>
>
>
> --
> Thanks,
>
> Steve
--
Murphy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-03-23 5:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 12:46 [PATCH v3] CIFS: check new file size when extending file by fallocate Murphy Zhou
[not found] ` <CAH2r5muTx3DmGZ+ZedrNmPK8ZHq10XZ3RXxVD0H6RmEcBvnVPQ@mail.gmail.com>
2020-03-23 0:24 ` Murphy Zhou
2020-03-23 3:36 ` Steve French
2020-03-23 3:51 ` Steve French
2020-03-23 3:52 ` Steve French
2020-03-23 5:13 ` Murphy Zhou
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).