Search code examples
linuxfilesystemscluster-computingmountglusterfs

Linux file exception:Device or resource busy


An simplified load balance cluster scene: 2 CentOS7 with GlusterFS to share some configuration files(Replicate type),and mount the Gluster filesystem to each node(eg. /mnt/gluster/); then I used mount --bind command to link the *.conf file from glusterfs mount point to my application dir(eg. /my/app/).

I modify the conf file in /my/app/ dir, it could spread the modification correctly to each node in the cluster. But once I modified files in such as /mnt/gluster/example.conf, the mount point of this file(like /my/app/example.conf) would turn to unreachable status. Looks like:

[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

My question:

  1. If the original file can be modified when we using 'mount --bind' to it?

  2. Why the file turn to a ghost file? (No such file or directory or Device or resource busy).


Solution

    1. mounted file could not be changed before it was umount, it means you can not modify the metadata of the mounted files.
    2. Once you changed the metadata of files mounted, it will turn to separate file no longer associated with the source file. It can proved by the inode of the file.
    3. File managed by GlusterFS may have a strange inode which have a much more large inode number that cannot be recognized by Linux file system('??????' in output). You can mount this type of file but can not change its metadata when it has been mounted.