Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] CIFS: fiemap: do not return EINVAL if get nothing
@ 2020-03-14  3:38 Murphy Zhou
  2020-03-14 16:26 ` Pavel Shilovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Murphy Zhou @ 2020-03-14  3:38 UTC (permalink / raw)
  To: linux-cifs; +Cc: Ronnie Sahlberg, Steve French

If we call fiemap on a truncated file with none blocks allocated,
it makes sense we get nothing from this call. No output means
no blocks have been counted, but the call succeeded. It's a valid
response.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.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 c31e84ee3c39..32b7f9795d4a 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -3417,7 +3417,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
 	if (rc)
 		goto out;
 
-	if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
+	if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
 		rc = -EINVAL;
 		goto out;
 	}
-- 
2.20.1

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

* Re: [PATCH] CIFS: fiemap: do not return EINVAL if get nothing
  2020-03-14  3:38 [PATCH] CIFS: fiemap: do not return EINVAL if get nothing Murphy Zhou
@ 2020-03-14 16:26 ` Pavel Shilovsky
  2020-03-15  4:57   ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Shilovsky @ 2020-03-14 16:26 UTC (permalink / raw)
  To: Murphy Zhou; +Cc: linux-cifs, Ronnie Sahlberg, Steve French

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky

пт, 13 мар. 2020 г. в 20:40, Murphy Zhou <jencce.kernel@gmail.com>:
>
> If we call fiemap on a truncated file with none blocks allocated,
> it makes sense we get nothing from this call. No output means
> no blocks have been counted, but the call succeeded. It's a valid
> response.
>
> Signed-off-by: Murphy Zhou <jencce.kernel@gmail.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 c31e84ee3c39..32b7f9795d4a 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -3417,7 +3417,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
>         if (rc)
>                 goto out;
>
> -       if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
> +       if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
>                 rc = -EINVAL;
>                 goto out;
>         }
> --
> 2.20.1

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

* Re: [PATCH] CIFS: fiemap: do not return EINVAL if get nothing
  2020-03-14 16:26 ` Pavel Shilovsky
@ 2020-03-15  4:57   ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2020-03-15  4:57 UTC (permalink / raw)
  To: Pavel Shilovsky; +Cc: Murphy Zhou, linux-cifs, Ronnie Sahlberg, Steve French

merged into cifs-2.6.git for-next

On Sat, Mar 14, 2020 at 8:30 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>
> --
> Best regards,
> Pavel Shilovsky
>
> пт, 13 мар. 2020 г. в 20:40, Murphy Zhou <jencce.kernel@gmail.com>:
> >
> > If we call fiemap on a truncated file with none blocks allocated,
> > it makes sense we get nothing from this call. No output means
> > no blocks have been counted, but the call succeeded. It's a valid
> > response.
> >
> > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.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 c31e84ee3c39..32b7f9795d4a 100644
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -3417,7 +3417,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
> >         if (rc)
> >                 goto out;
> >
> > -       if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
> > +       if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
> >                 rc = -EINVAL;
> >                 goto out;
> >         }
> > --
> > 2.20.1



-- 
Thanks,

Steve

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-14  3:38 [PATCH] CIFS: fiemap: do not return EINVAL if get nothing Murphy Zhou
2020-03-14 16:26 ` Pavel Shilovsky
2020-03-15  4:57   ` Steve French

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org
	public-inbox-index linux-cifs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git