linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: zero-range does not require the file is sparse
@ 2019-04-11 23:56 Ronnie Sahlberg
  2019-04-12  0:10 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Ronnie Sahlberg @ 2019-04-11 23:56 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Ronnie Sahlberg

Remove the conditional to fail zero-range if the file is not flagged as sparse.
You can still zero out a range in SMB2 even for non-sparse files.

Tested with stock windows16 server.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2ops.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index ca952dc3ec75..56e85f46cd82 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2664,18 +2664,6 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
 			return rc;
 		}
 
-	/*
-	 * Must check if file sparse since fallocate -z (zero range) assumes
-	 * non-sparse allocation
-	 */
-	if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) {
-		rc = -EOPNOTSUPP;
-		trace_smb3_zero_err(xid, cfile->fid.persistent_fid, tcon->tid,
-			      ses->Suid, offset, len, rc);
-		free_xid(xid);
-		return rc;
-	}
-
 	cifs_dbg(FYI, "offset %lld len %lld", offset, len);
 
 	fsctl_buf.FileOffset = cpu_to_le64(offset);
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: zero-range does not require the file is sparse
  2019-04-11 23:56 [PATCH] cifs: zero-range does not require the file is sparse Ronnie Sahlberg
@ 2019-04-12  0:10 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2019-04-12  0:10 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: linux-cifs, Steve French

I verified it fixed 5 xfstests (033, 149, 155, 180, 349)

On Thu, Apr 11, 2019 at 6:56 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> Remove the conditional to fail zero-range if the file is not flagged as sparse.
> You can still zero out a range in SMB2 even for non-sparse files.
>
> Tested with stock windows16 server.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2ops.c | 12 ------------
>  1 file changed, 12 deletions(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index ca952dc3ec75..56e85f46cd82 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -2664,18 +2664,6 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
>                         return rc;
>                 }
>
> -       /*
> -        * Must check if file sparse since fallocate -z (zero range) assumes
> -        * non-sparse allocation
> -        */
> -       if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) {
> -               rc = -EOPNOTSUPP;
> -               trace_smb3_zero_err(xid, cfile->fid.persistent_fid, tcon->tid,
> -                             ses->Suid, offset, len, rc);
> -               free_xid(xid);
> -               return rc;
> -       }
> -
>         cifs_dbg(FYI, "offset %lld len %lld", offset, len);
>
>         fsctl_buf.FileOffset = cpu_to_le64(offset);
> --
> 2.13.6
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-12  0:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 23:56 [PATCH] cifs: zero-range does not require the file is sparse Ronnie Sahlberg
2019-04-12  0:10 ` Steve French

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).