cifs: improve checking of DFS links over STATUS_OBJECT_NAME_INVALID
authorPaulo Alcantara <pc@manguebit.com>
Tue, 28 Feb 2023 22:01:54 +0000 (19:01 -0300)
committerSteve French <stfrench@microsoft.com>
Thu, 2 Mar 2023 00:18:25 +0000 (18:18 -0600)
commitb9ee2e307c6b06384b6f9e393a9b8e048e8fc277
tree56eddce76ca31f3fa8fb2fbe26a300e9bd80f38d
parent4c0421fa6df136ff869a078594b4b7b7637e566a
cifs: improve checking of DFS links over STATUS_OBJECT_NAME_INVALID

Do not map STATUS_OBJECT_NAME_INVALID to -EREMOTE under non-DFS
shares, or 'nodfs' mounts or CONFIG_CIFS_DFS_UPCALL=n builds.
Otherwise, in the slow path, get a referral to figure out whether it
is an actual DFS link.

This could be simply reproduced under a non-DFS share by running the
following

  $ mount.cifs //srv/share /mnt -o ...
  $ cat /mnt/$(printf '\U110000')
  cat: '/mnt/'$'\364\220\200\200': Object is remote

Fixes: c877ce47e137 ("cifs: reduce roundtrips on create/qinfo requests")
CC: stable@vger.kernel.org # 6.2
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifsproto.h
fs/cifs/misc.c
fs/cifs/smb2inode.c
fs/cifs/smb2ops.c