I've an interesting situation here with disappearing directory on a samba
server.
samba version 4.21.1+dfsg-2~bpo12+1 (4.21.1 on debian), client is
windows 10 (21H2 LTSC).
There's a single directory on the server which appears non-existing when
one tries to chdir to from windows.
The directory in question is \strakh\release.4\Rossita_prepare.
When trying to chdir to it from the client, windows reports "0x03
the system can not find the path specified". The directory does
exist and has files, and it is not a permission problem for sure.
When trying to chdir to it (and getting this error), `net use` reports
one extra item in the network usage list, with this very directory:
\\tsrv\ws\strakh\release.4\Rossita_prepare
Microsoft Windows Network
which does not happen for other dirs. This happens for whole client
machine - I can log in as different user (both has permissions for this
dir, see below), and the other user also receives the same 0x03 error.
And what is the most interesting here - I can connect to the same
server using different name (eg, with domain), - and this new connection
works just fine with the same users, everyone can chdir to this dir
without any issues whatsoever.
I can kill this smbd, windows re-opens the connection automatically,
and the same issue (0x03 error) reoccurs.
This does not happen on other windows machines but the same users.
In tcpdump I see:
4 0.962527 192.168.19.16 192.168.177.2 SMB2 342 Create Request File:
strakh\release.4\Rossita_prepare
5 0.962877 192.168.177.2 192.168.19.16 SMB2 131 Create Response, Error:
STATUS_OBJECT_NAME_NOT_FOUND
when opening nearby dirs or opening the same dir but using a different
name of the same server, the server replies with success.
In strace, I see this. For unsuccessful open:
chdir("/ws/ws") = 0
newfstatat(AT_FDCWD, ".", {st_mode=S_IFDIR|S_ISGID|0755, st_size=90,
...}, 0) = 0
newfstatat(AT_FDCWD, "/ws/ws", {st_mode=S_IFDIR|S_ISGID|0755,
st_size=90, ...}, 0) = 0
getcwd("/ws/ws", 1024) = 7
openat(AT_FDCWD, ".", O_RDONLY|O_NOFOLLOW|O_PATH) = 8
newfstatat(8, "", {st_mode=S_IFDIR|S_ISGID|0755, st_size=90, ...},
AT_EMPTY_PATH) = 0
openat(8, "Rossita_prepare", O_RDONLY|O_NOFOLLOW|O_PATH) = -1 ENOENT
For a successful open of a nearby dir:
chdir("/ws/ws") = 0
newfstatat(AT_FDCWD, ".", {st_mode=S_IFDIR|S_ISGID|0755, st_size=90,
...}, 0) = 0
newfstatat(AT_FDCWD, "/ws/ws", {st_mode=S_IFDIR|S_ISGID|0755,
st_size=90, ...}, 0) = 0
openat2(AT_FDCWD, "strakh/release.4",
{flags=O_RDONLY|O_NOFOLLOW|O_PATH, resolve=RESOLVE_NO_SYMLINKS}, 24) = 13
newfstatat(13, "", {st_mode=S_IFDIR|S_ISGID|0775, st_size=200, ...},
AT_EMPTY_PATH) = 0
openat(13, "Rossita_fixed", O_RDONLY|O_NOFOLLOW|O_PATH) = 34
note samba used "." instead of "strakh/release.4" in the
openat2() call
in first, unsuccessful, version. There's also one extra getcwd call.
Ok. I just copied Rossita_current dir to the root of this share, - and voila,
I can now chdir to this dir, but obviously it's wrong.
After removing this dir (while staying in it in windows), the client now
started showing empty directory instead of an error.
After issuing `net use ...\Rossita_prepare /d` so this extra entry got
removed from the net usage table, we returned back to 0x03 error.
It looks like the thing has become quite confused somewhere, and it looks
like this is samba who become confused. It shouldn't try to open
\Rossita_prepare when asked to open \strakh\release.r\Rossita_prepare,
no matter what.
So it looks like a bug in samba.
Any help I can provide to find and fix this one, while the issue can
be reproduced here?
Thanks,
/mjt