Re: [PATCH v1] cifs: smb2ops: Fix listxattr() when there are no EAs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



merged into cifs-2.6.git for-next thx

On Fri, May 4, 2018 at 9:25 AM, Paulo Alcantara <palcantara@xxxxxxx> wrote:
> As per listxattr(2):
>
>        On success, a nonnegative number is returned indicating the size
>        of the extended attribute name list.  On failure, -1 is returned
>        and errno  is set appropriately.
>
> In SMB1, when the server returns an empty EA list through a listxattr(),
> it will correctly return 0 as there are no EAs for the given file.
>
> However, in SMB2+, it returns -ENODATA in listxattr() which is wrong since
> the request and response were sent successfully, although there's no actual
> EA for the given file.
>
> This patch fixes listxattr() for SMB2+ by returning 0 in cifs_listxattr()
> when the server returns an empty list of EAs.
>
> Signed-off-by: Paulo Alcantara <palcantara@xxxxxxx>
> ---
>  fs/cifs/smb2ops.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 117603b83b6c..12875d55c5a9 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -632,9 +632,15 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
>
>         SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
>
> +       /*
> +        * If ea_name is NULL (listxattr) and there are no EAs, return 0 as it's
> +        * not an error. Otherwise, the specified ea_name was not found.
> +        */
>         if (!rc)
>                 rc = move_smb2_ea_to_cifs(ea_data, buf_size, smb2_data,
>                                           SMB2_MAX_EA_BUF, ea_name);
> +       else if (!ea_name && rc == -ENODATA)
> +               rc = 0;
>
>         kfree(smb2_data);
>         return rc;
> --
> 2.13.6
>



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux