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, 1 Jun 2023 04:18:41 +0000 (23:18 -0500)
commit8deb2a59b8f4997f8c228f80d5faa10e8a353416
treed495a7f37700adb877b23c261675e0b968051f04
parentfe29273c2f60dd710c8f401669943d0f924f7a1c
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