无法删除 Linux 目录 - 无限递归

old*_*kes 8 linux redhat nfs

我们在支持我们的版本控制服务器的 RHEL6 VM 上安装了 NFS - 最近,其中一个存储库有点疯狂,这是我在服务器上发现的:

ls -latri repo.git/refs/heads/

total 28
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21 .
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21
5551209 drwxr-xr-x. 3 git git 4096 Jun  1 22:09 ..
Run Code Online (Sandbox Code Playgroud)

当我tree针对目录运行时,它似乎是无限递归的 - 例如:

repo.git/refs/heads/
???
?   ???
?   ?   ???
?   ?   ?   ???
?   ?   ?   ?   ???
?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ?   ???
Run Code Online (Sandbox Code Playgroud)

我试图通过其 inode ref 删除存储库:

[root@node repo.git/refs]# ls -latri
total 16
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21 heads

[root@node repo.git/refs]# find . -inum 5551210 -exec rm -rf {} \;
rm: cannot remove `./refs/heads': Directory not empty
find: `./refs/heads/': No such file or directory
find: `./refs/heads/': No such file or directory
Run Code Online (Sandbox Code Playgroud)

我有点不知所措 -ls -latri命令上的 inode 信息似乎表明“heads”目录中有 2 个目录是指向 head 目录的硬链接?

任何有关如何清理它的想法都将受到欢迎 - 认为我已经解决了它引起的应用程序问题,但需要对文件系统的更大问题进行排序。

谢谢!

编辑:一些额外的输出:

没有隐藏字符:

[root@node repo.git/refs]# ls -latrib heads/
total 28
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21 .
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21
5551209 drwxr-xr-x. 3 git git 4096 Jun  1 22:09 ..
Run Code Online (Sandbox Code Playgroud)

但是当我实际上head 目录中时,这里有一些有趣的输出:

[root@node repo.git/refs/heads]# ls -latrib
ls: cannot access : No such file or directory
ls: cannot access : No such file or directory
total 12
      ? -?????????? ? ?   ?      ?            ?
      ? -?????????? ? ?   ?      ?            ?
5551210 drwxr-xr-x. 2 git git 8192 Jun  1 21:21 .
5551209 drwxr-xr-x. 3 git git 4096 Jun  1 22:09 ..
Run Code Online (Sandbox Code Playgroud)

rui*_*ief 3

第一:Git 既不是问题的原因,也不是问题的解决方案,该问题表现为ls. 停止在文件系统上使用 Git 或其他工具并将其卸载以避免造成损害。

这看起来像是文件系统损坏或挂载损坏。尝试卸载并重新安装客户端上的文件系统。尝试完全重新启动客户端。尝试在另一个客户端上执行相同的安装。每次检查ls输出是否正常。这将帮助您诊断问题是否出在 NFS 服务器端。如果ls输出仍然看起来相同,则fsck需要在服务器端对文件系统(或其他)和/或 NFS 服务进行调查和修复(重新启动 NFS 相关守护进程;如果 nfsd 位于内核中,则重新启动)。