diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-09-12 22:16:34 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-10-22 20:24:38 -0400 |
commit | 032dbb3b503a30fce732ec4c05525d0abed1f1d6 (patch) | |
tree | 462696abcf0783d50efe97a3ca2641beecc91a3e /fs/nilfs2/cpfile.c | |
parent | f1e89c86fdd0f5e59f6768146c86437934202033 (diff) |
nilfs2: see state of root dentry for mount check of snapshots
After applied the patch that unified sb instances, root dentry of
snapshots can be left in dcache even after their trees are unmounted.
The orphan root dentry/inode keeps a root object, and this causes
false positive of nilfs_checkpoint_is_mounted function.
This resolves the issue by having nilfs_checkpoint_is_mounted test
whether the root dentry is busy or not.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/cpfile.c')
-rw-r--r-- | fs/nilfs2/cpfile.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 03de1da8795b..5ff15a8a1024 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -863,26 +863,19 @@ int nilfs_cpfile_is_snapshot(struct inode *cpfile, __u64 cno) | |||
863 | */ | 863 | */ |
864 | int nilfs_cpfile_change_cpmode(struct inode *cpfile, __u64 cno, int mode) | 864 | int nilfs_cpfile_change_cpmode(struct inode *cpfile, __u64 cno, int mode) |
865 | { | 865 | { |
866 | struct the_nilfs *nilfs; | ||
867 | int ret; | 866 | int ret; |
868 | 867 | ||
869 | nilfs = NILFS_MDT(cpfile)->mi_nilfs; | ||
870 | |||
871 | switch (mode) { | 868 | switch (mode) { |
872 | case NILFS_CHECKPOINT: | 869 | case NILFS_CHECKPOINT: |
873 | /* | 870 | if (nilfs_checkpoint_is_mounted(cpfile->i_sb, cno)) |
874 | * Check for protecting existing snapshot mounts: | 871 | /* |
875 | * ns_mount_mutex is used to make this operation atomic and | 872 | * Current implementation does not have to protect |
876 | * exclusive with a new mount job. Though it doesn't cover | 873 | * plain read-only mounts since they are exclusive |
877 | * umount, it's enough for the purpose. | 874 | * with a read/write mount and are protected from the |
878 | */ | 875 | * cleaner. |
879 | if (nilfs_checkpoint_is_mounted(nilfs, cno, 1)) { | 876 | */ |
880 | /* Current implementation does not have to protect | ||
881 | plain read-only mounts since they are exclusive | ||
882 | with a read/write mount and are protected from the | ||
883 | cleaner. */ | ||
884 | ret = -EBUSY; | 877 | ret = -EBUSY; |
885 | } else | 878 | else |
886 | ret = nilfs_cpfile_clear_snapshot(cpfile, cno); | 879 | ret = nilfs_cpfile_clear_snapshot(cpfile, cno); |
887 | return ret; | 880 | return ret; |
888 | case NILFS_SNAPSHOT: | 881 | case NILFS_SNAPSHOT: |