diff mbox

[CIFS] Return correct error code on query xattr when empty xattr list

Message ID CAH2r5msaxk6hGCL_HiQ+ZGK4L7Ryr=uKYyhwTfrz7CvtSgd7Pg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve French March 26, 2014, 12:53 a.m. UTC
In working on getting xfstest working on cifs found the following problem.

From c6845613066b4544978de749cd5c73fb14ed936b Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
Date: Tue, 25 Mar 2014 19:46:36 -0500
Subject: [PATCH] [CIFS] Return correct error on query of xattr on file with
 empty xattrs

xfstest 020 detected a problem with cifs xattr handling.  When a file
had an empty xattr list, we returned success (with an empty xattr value)
on query of particular xattrs rather than returning ENODATA.
This patch fixes it so that query of an xattr returns ENODATA when the
xattr list is empty for the file.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/cifssmb.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jeff Layton March 26, 2014, 2:30 p.m. UTC | #1
On Tue, 25 Mar 2014 19:53:40 -0500
Steve French <smfrench@gmail.com> wrote:

> In working on getting xfstest working on cifs found the following
> problem.
> 
> From c6845613066b4544978de749cd5c73fb14ed936b Mon Sep 17 00:00:00 2001
> From: Steve French <smfrench@gmail.com>
> Date: Tue, 25 Mar 2014 19:46:36 -0500
> Subject: [PATCH] [CIFS] Return correct error on query of xattr on
> file with empty xattrs
> 
> xfstest 020 detected a problem with cifs xattr handling.  When a file
> had an empty xattr list, we returned success (with an empty xattr
> value) on query of particular xattrs rather than returning ENODATA.
> This patch fixes it so that query of an xattr returns ENODATA when the
> xattr list is empty for the file.
> 
> Signed-off-by: Steve French <smfrench@gmail.com>
> ---
>  fs/cifs/cifssmb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index f3264bd..6ce4e09 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -6197,6 +6197,9 @@ QAllEAsRetry:
>      cifs_dbg(FYI, "ea length %d\n", list_len);
>      if (list_len <= 8) {
>          cifs_dbg(FYI, "empty EA list returned from server\n");
> +        /* didn't find the named attribute */
> +        if (ea_name)
> +            rc = -ENODATA;
>          goto QAllEAsOut;
>      }
> 


Reviewed-by: Jeff Layton <jlayton@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From c6845613066b4544978de749cd5c73fb14ed936b Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
Date: Tue, 25 Mar 2014 19:46:36 -0500
Subject: [PATCH] [CIFS] Return correct error on query of xattr on file with
 empty xattrs

xfstest 020 detected a problem with cifs xattr handling.  When a file
had an empty xattr list, we returned success (with an empty xattr value)
on query of particular xattrs rather than returning ENODATA.
This patch fixes it so that query of an xattr returns ENODATA when the
xattr list is empty for the file.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/cifssmb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index f3264bd..6ce4e09 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -6197,6 +6197,9 @@  QAllEAsRetry:
 	cifs_dbg(FYI, "ea length %d\n", list_len);
 	if (list_len <= 8) {
 		cifs_dbg(FYI, "empty EA list returned from server\n");
+		/* didn't find the named attribute */
+		if (ea_name)
+			rc = -ENODATA;
 		goto QAllEAsOut;
 	}
 
-- 
1.8.5.3