All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: fix incorrect handling of smb2_set_sparse() return in smb3_simple_falloc
@ 2019-03-14  2:58 Ronnie Sahlberg
  0 siblings, 0 replies; 4+ messages in thread
From: Ronnie Sahlberg @ 2019-03-14  2:58 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Ronnie Sahlberg

smb2_set_sparse does not return -errno, it returns a boolean where
true means success.
Change this to just ignore the return value just like the other callsites.

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

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index eee5a27ca95e..581eaa5f34f8 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2781,7 +2781,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
 			return rc;
 		}
 
-		rc = smb2_set_sparse(xid, tcon, cfile, inode, false);
+		smb2_set_sparse(xid, tcon, cfile, inode, false);
 	}
 	/* BB: else ... in future add code to extend file and set sparse */
 
-- 
2.13.6


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

* Re: [PATCH] cifs: fix incorrect handling of smb2_set_sparse() return in smb3_simple_falloc
  2019-03-14 14:08 Ronnie Sahlberg
@ 2019-03-14 15:56 ` Steve French
  0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2019-03-14 15:56 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: linux-cifs, Steve French

Merged into cifs-2.6.git fo-next and kicked off the buildbot with
current for-next

http://smb3-test-rhel-75.southcentralus.cloudapp.azure.com/#/builders/2/builds/162

On Thu, Mar 14, 2019 at 9:08 AM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> smb2_set_sparse does not return -errno, it returns a boolean where
> true means success.
> Change this to just ignore the return value just like the other callsites.
>
> Additionally add code to handle the case where we must set the file sparse
> and possibly also extending it.
>
> Fixes xfstests: generic/236 generic/350 generic/420
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/cifs/smb2ops.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 32dde87feaa9..03814b9f113d 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -2718,6 +2718,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
>         struct cifsFileInfo *cfile = file->private_data;
>         long rc = -EOPNOTSUPP;
>         unsigned int xid;
> +       __le64 eof;
>
>         xid = get_xid();
>
> @@ -2777,9 +2778,18 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
>                         return rc;
>                 }
>
> -               rc = smb2_set_sparse(xid, tcon, cfile, inode, false);
> +               smb2_set_sparse(xid, tcon, cfile, inode, false);
> +               rc = 0;
> +       } else {
> +               smb2_set_sparse(xid, tcon, cfile, inode, false);
> +               rc = 0;
> +               if (i_size_read(inode) < off + len) {
> +                       eof = cpu_to_le64(off + len);
> +                       rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
> +                                         cfile->fid.volatile_fid, cfile->pid,
> +                                         &eof);
> +               }
>         }
> -       /* BB: else ... in future add code to extend file and set sparse */
>
>         if (rc)
>                 trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, tcon->tid,
> --
> 2.13.6
>


-- 
Thanks,

Steve

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

* [PATCH] cifs: fix incorrect handling of smb2_set_sparse() return in smb3_simple_falloc
@ 2019-03-14 14:08 Ronnie Sahlberg
  2019-03-14 15:56 ` Steve French
  0 siblings, 1 reply; 4+ messages in thread
From: Ronnie Sahlberg @ 2019-03-14 14:08 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Ronnie Sahlberg, Steve French

smb2_set_sparse does not return -errno, it returns a boolean where
true means success.
Change this to just ignore the return value just like the other callsites.

Additionally add code to handle the case where we must set the file sparse
and possibly also extending it.

Fixes xfstests: generic/236 generic/350 generic/420

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 32dde87feaa9..03814b9f113d 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2718,6 +2718,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
 	struct cifsFileInfo *cfile = file->private_data;
 	long rc = -EOPNOTSUPP;
 	unsigned int xid;
+	__le64 eof;
 
 	xid = get_xid();
 
@@ -2777,9 +2778,18 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
 			return rc;
 		}
 
-		rc = smb2_set_sparse(xid, tcon, cfile, inode, false);
+		smb2_set_sparse(xid, tcon, cfile, inode, false);
+		rc = 0;
+	} else {
+		smb2_set_sparse(xid, tcon, cfile, inode, false);
+		rc = 0;
+		if (i_size_read(inode) < off + len) {
+			eof = cpu_to_le64(off + len);
+			rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
+					  cfile->fid.volatile_fid, cfile->pid,
+					  &eof);
+		}
 	}
-	/* BB: else ... in future add code to extend file and set sparse */
 
 	if (rc)
 		trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, tcon->tid,
-- 
2.13.6


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

* [PATCH] cifs: fix incorrect handling of smb2_set_sparse() return in smb3_simple_falloc
@ 2019-03-14  3:43 Ronnie Sahlberg
  0 siblings, 0 replies; 4+ messages in thread
From: Ronnie Sahlberg @ 2019-03-14  3:43 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Ronnie Sahlberg

smb2_set_sparse does not return -errno, it returns a boolean where
true means success.
Change this to just ignore the return value just like the other callsites.

Additionally add code to handle the case where we must set the file sparse
and possibly also extending it.

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

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index eee5a27ca95e..fddfbda4f710 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2781,9 +2781,18 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
 			return rc;
 		}
 
-		rc = smb2_set_sparse(xid, tcon, cfile, inode, false);
+		smb2_set_sparse(xid, tcon, cfile, inode, false);
+		rc = 0;
+	} else {
+		smb2_set_sparse(xid, tcon, cfile, inode, false);
+		rc = 0;
+		if (i_size_read(inode) < off + len) {
+			eof = cpu_to_le64(off + len);
+			rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
+					  cfile->fid.volatile_fid, cfile->pid,
+					  &eof);
+		}
 	}
-	/* BB: else ... in future add code to extend file and set sparse */
 
 	if (rc)
 		trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, tcon->tid,
-- 
2.13.6


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

end of thread, other threads:[~2019-03-14 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14  2:58 [PATCH] cifs: fix incorrect handling of smb2_set_sparse() return in smb3_simple_falloc Ronnie Sahlberg
2019-03-14  3:43 Ronnie Sahlberg
2019-03-14 14:08 Ronnie Sahlberg
2019-03-14 15:56 ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.