cifs: plumb smb2 POSIX dir enumeration
authorAurelien Aptel <aaptel@suse.com>
Sat, 8 Feb 2020 14:50:58 +0000 (15:50 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 23 Mar 2020 03:49:09 +0000 (22:49 -0500)
commit3d519bd1269f1f439db818e04252022ecffdef51
tree7779c1185395fa7c55f0d42c7ad73b718e27e45a
parent349e13ad30b45998bb9937cfe0b32be6f951976d
cifs: plumb smb2 POSIX dir enumeration

* add code to request POSIX info level
* parse dir entries and fill cifs_fattr to get correct inode data

since the POSIX payload is variable size the number of entries in a
FIND response needs to be computed differently.

Dirs and regular files are properly reported along with mode bits,
hardlink number, c/m/atime. No special files yet (see below).

Current experimental version of Samba with the extension unfortunately
has issues with wildcards and needs the following patch:

> --- i/source3/smbd/smb2_query_directory.c
> +++ w/source3/smbd/smb2_query_directory.c
> @@ -397,9 +397,7 @@ smbd_smb2_query_directory_send(TALLOC_CTX
> *mem_ctx,
>  }
>  }
>
> -       if (!state->smbreq->posix_pathnames) {
>  wcard_has_wild = ms_has_wild(state->in_file_name);
> -       }
>
>  /* Ensure we've canonicalized any search path if not a wildcard. */
>  if (!wcard_has_wild) {
>

Also for special files despite reporting them as reparse point samba
doesn't set the reparse tag field. This patch will mark them as needing
re-evaluation but the re-evaluate code doesn't deal with it yet.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/readdir.c
fs/cifs/smb2pdu.c