Scenario
- a NFS share is mounted on
/mnt/temp/dir(and other shares are mounted in subdirectories), - I
umounteverything there but supposedly, it doesn't work well (maybe I start withumount /mnt/temp/dirinstead of umounting "nested" shares like/mnt/temp/dir/subdir*first), - I do
mount -o bind /data/temp /mnt/temp, - I do
mount /mnt/temp/dir, - I do
mount /mnt/temp/dir/subdir1... and it works well.
Note: /mnt/temp is initially hosted on the root filesystem (/), and /data is another filesystem.
Problem
I cannot delete the /mnt/temp/dir directory on the root filesystem:
# mount -o bind / /test/root
# rmdir /test/root/mnt/temp/dir
rmdir: failed to remove `dir': Device or resource busy
Some explaination
/mnt/temp/dir is mounted twice , probably once on the root fs, and once on the /data fs.
Here is cat /proc/mounts:
nfsserver:/some/share/ /mnt/temp/dir nfs rw,relatime(...) 0 0
nfsserver:/some/share/ /mnt/temp/dir nfs rw,relatime,(...) 0 0
More interesting, here is cat /proc/1/mountinfo:
29 20 0:18 / /mnt/temp/dir rw,relatime - nfs nfsserver:/some/share/ rw,(...)
33 31 0:18 / /mnt/temp/dir rw,relatime - nfs nfsserver:/some/share/ rw,(...)
See, the two numbers at the beginning are different.
Kernel doc says for these two fields:
(1) mount ID: unique identifier of the mount (may be reused after umount)
(2) parent ID: ID of parent (or of self for the top of the mount tree)
Question
How can I identify which one is the "bad" mount and how can I umount it?
Even the system call umount(2) takes a path for argument, and not an "mount ID".
Aucun commentaire:
Enregistrer un commentaire