Linux 文件 exception:Device 或资源繁忙

Linux file exception:Device or resource busy

一个简化的负载均衡集群场景:2台CentOS7与GlusterFS共享一些配置文件(Replicate类型),并将Gluster文件系统挂载到各个节点(eg. /mnt/gluster/);然后我使用 mount --bind 命令 link *.conf 文件从 glusterfs 挂载点到我的应用程序目录(例如 /my/app/)。

我修改了/my/app/目录下的conf文件,它可以将修改正确地传播到集群中的每个节点。但是一旦我修改了/mnt/gluster/example.conf中的文件,这个文件的挂载点(如/my/app/example.conf)就会变成无法访问的状态。看起来像:

[root@gluster1 mount]#ll
  ls: cannot access 1: No such file or directory
  total 0
  -????????? ? ? ? ?            ? example.conf
  [root@gluster1 mount]#mv example.conf example.bak
  mv: cannot move ‘example.conf’ to ‘example.bak’: Device or resource busy

我的问题:

  1. 使用'mount --bind'时是否可以修改原文件?

  2. 为什么文件变成了ghost文件? (没有这样的文件或目录设备或资源繁忙)。

  1. mounted文件在umount之前无法更改,这意味着您无法修改已挂载文件的元数据。
  2. 一旦你改变了加载文件的元数据,它将变成一个单独的文件,不再与源文件相关联。可以通过文件的inode来证明。
  3. GlusterFS 管理的文件可能有一个奇怪的 inode,它有一个更大的 inode 编号,Linux 文件系统无法识别('???? ??' 在输出中)。您可以装载此类文件,但装载后不能更改其元数据。