无法删除 samba 共享上的文件夹

无法删除 samba 共享上的文件夹

我正在处理一个非常奇怪的问题,我无法确定其原因。我在 Rocky 9.2 中使用 autofs 和 flags 安装了一个 samba 共享-fstype=cifs,rw,nounix,file_mode=0700,dir_mode=0700,multiuser,sec=krb5,user=username,cruid=username,gid=primarygroup,_netdev

它安装得很好,我可以很好地添加和删除文件,但当我尝试删除内容时,文件夹的行为非常奇怪。例如以下内容:

$ mkdir dir
$ mkdir dir/{a,b}
$ touch dir/{a,b}/f{1..5}
$ tree dir
dir
├── a
│   ├── f1
│   ├── f2
│   ├── f3
│   ├── f4
│   └── f5
└── b
    ├── f1
    ├── f2
    ├── f3
    ├── f4
    └── f5

2 directories, 10 files
$ rm --recursive --force --verbose dir
removed 'dir/b/f2'
removed 'dir/b/f4'
removed 'dir/b/f5'
removed 'dir/b/f1'
removed 'dir/b/f3'
removed directory 'dir/b'
removed 'dir/a/f2'
removed 'dir/a/f4'
removed 'dir/a/f5'
removed 'dir/a/f1'
removed 'dir/a/f3'
removed directory 'dir/a'
rm: cannot remove 'dir': Directory not empty
$ tree dir
dir
├── a
└── b

2 directories, 0 files
$ rm --recursive --force --verbose dir
rm: cannot remove 'dir': Directory not empty
$ ls --all --recursive dir # in the output note the lack of . and .. in dir/a and dir/b
dir:
.  ..  a  b

dir/a:

dir/b:
$ rmdir dir/a
rmdir: failed to remove 'dir/a': No such file or directory
$ rmdir dir/b
rmdir: failed to remove 'dir/b': No such file or directory
$ tree dir
dir
├── a
└── b

2 directories, 0 files
$ ls --all --recursive -l dir
dir:
total 0
drwx------. 2 username primarygroup 0 Jun  9 16:23 .
drwx------. 2 username primarygroup 0 Jun  9 16:23 ..
drwx------. 2 username primarygroup 0 Jun  9 16:23 a
drwx------. 2 username primarygroup 0 Jun  9 16:23 b

dir/a:
total 0

dir/b:
total 0

我尝试以 root 身份执行此操作,0777为文件和目录授予权限,并手动安装它而不是使用 autofs,我得到了相同的行为。

日志中似乎没有出现相关消息(不排除我可能没有查看正确的日志)。

更新 1:关闭 SELinux 没有帮助。关闭防火墙也没有。

更新 2:似乎重新启动 autofs 会清除它们(通常需要重新启动)。但它不会始终如一地删除所有这些内容。两次重新启动后,没有额外的调用rmrmdir文件夹完全消失。但我仍然可以重现这个问题。所以我猜 SMB 服务器必须具有正确的信息,但它可能没有在本地表示......?

更新 3:我打开了cifs.我用 做了这个echo 7 | sudo tee /proc/fs/cifs/cifsFYI。然后,当我再次执行更简单版本的步骤时:

$ mkdir --parent h/a

同时在日志中我们得到:

Jun 12 16:04:56 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
$ rm --recursive h
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0x80000006 STATUS_NO_MORE_FILES
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0x80000006 STATUS_NO_MORE_FILES
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:12 localhost kernel: CIFS: Status code returned 0xc0000101 STATUS_DIRECTORY_NOT_EMPTY
$ rm --recursive h
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0x80000006 STATUS_NO_MORE_FILES
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000056 STATUS_DELETE_PENDING
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000056 STATUS_DELETE_PENDING
Jun 12 16:05:27 localhost kernel: CIFS: Status code returned 0xc0000056 STATUS_DELETE_PENDING
$ tree h
h
└── a

1 directory, 0 files
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0x80000006 STATUS_NO_MORE_FILES
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0xc0000056 STATUS_DELETE_PENDING
Jun 12 16:07:28 localhost kernel: CIFS: Status code returned 0xc0000056 STATUS_DELETE_PENDING

相关内容