diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-05 11:50:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-05 11:50:26 -0400 |
commit | 45d9a2220f6004b47c362cc7fc7cf9a73cb6353a (patch) | |
tree | 4e2217464c5cd71674a6ffff1f3dddaeb52556b7 /fs/nilfs2 | |
parent | 2386a3b0fbb0c2dcf29694c7df9a72cb268458f0 (diff) | |
parent | 02afc27faec94c9e068517a22acf55400976c698 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile 1 from Al Viro:
"Unfortunately, this merge window it'll have a be a lot of small piles -
my fault, actually, for not keeping #for-next in anything that would
resemble a sane shape ;-/
This pile: assorted fixes (the first 3 are -stable fodder, IMO) and
cleanups + %pd/%pD formats (dentry/file pathname, up to 4 last
components) + several long-standing patches from various folks.
There definitely will be a lot more (starting with Miklos'
check_submount_and_drop() series)"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (26 commits)
direct-io: Handle O_(D)SYNC AIO
direct-io: Implement generic deferred AIO completions
add formats for dentry/file pathnames
kvm eventfd: switch to fdget
powerpc kvm: use fdget
switch fchmod() to fdget
switch epoll_ctl() to fdget
switch copy_module_from_fd() to fdget
git simplify nilfs check for busy subtree
ibmasmfs: don't bother passing superblock when not needed
don't pass superblock to hypfs_{mkdir,create*}
don't pass superblock to hypfs_diag_create_files
don't pass superblock to hypfs_vm_create_files()
oprofile: get rid of pointless forward declarations of struct super_block
oprofilefs_create_...() do not need superblock argument
oprofilefs_mkdir() doesn't need superblock argument
don't bother with passing superblock to oprofile_create_stats_files()
oprofile: don't bother with passing superblock to ->create_files()
don't bother passing sb to oprofile_create_files()
coh901318: don't open-code simple_read_from_buffer()
...
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/super.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index af3ba0478cdf..7ac2a122ca1d 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -994,23 +994,16 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | |||
994 | return ret; | 994 | return ret; |
995 | } | 995 | } |
996 | 996 | ||
997 | static int nilfs_tree_was_touched(struct dentry *root_dentry) | ||
998 | { | ||
999 | return d_count(root_dentry) > 1; | ||
1000 | } | ||
1001 | |||
1002 | /** | 997 | /** |
1003 | * nilfs_try_to_shrink_tree() - try to shrink dentries of a checkpoint | 998 | * nilfs_tree_is_busy() - try to shrink dentries of a checkpoint |
1004 | * @root_dentry: root dentry of the tree to be shrunk | 999 | * @root_dentry: root dentry of the tree to be shrunk |
1005 | * | 1000 | * |
1006 | * This function returns true if the tree was in-use. | 1001 | * This function returns true if the tree was in-use. |
1007 | */ | 1002 | */ |
1008 | static int nilfs_try_to_shrink_tree(struct dentry *root_dentry) | 1003 | static bool nilfs_tree_is_busy(struct dentry *root_dentry) |
1009 | { | 1004 | { |
1010 | if (have_submounts(root_dentry)) | ||
1011 | return true; | ||
1012 | shrink_dcache_parent(root_dentry); | 1005 | shrink_dcache_parent(root_dentry); |
1013 | return nilfs_tree_was_touched(root_dentry); | 1006 | return d_count(root_dentry) > 1; |
1014 | } | 1007 | } |
1015 | 1008 | ||
1016 | int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) | 1009 | int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) |
@@ -1034,8 +1027,7 @@ int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno) | |||
1034 | if (inode) { | 1027 | if (inode) { |
1035 | dentry = d_find_alias(inode); | 1028 | dentry = d_find_alias(inode); |
1036 | if (dentry) { | 1029 | if (dentry) { |
1037 | if (nilfs_tree_was_touched(dentry)) | 1030 | ret = nilfs_tree_is_busy(dentry); |
1038 | ret = nilfs_try_to_shrink_tree(dentry); | ||
1039 | dput(dentry); | 1031 | dput(dentry); |
1040 | } | 1032 | } |
1041 | iput(inode); | 1033 | iput(inode); |
@@ -1331,11 +1323,8 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1331 | 1323 | ||
1332 | s->s_flags |= MS_ACTIVE; | 1324 | s->s_flags |= MS_ACTIVE; |
1333 | } else if (!sd.cno) { | 1325 | } else if (!sd.cno) { |
1334 | int busy = false; | 1326 | if (nilfs_tree_is_busy(s->s_root)) { |
1335 | 1327 | if ((flags ^ s->s_flags) & MS_RDONLY) { | |
1336 | if (nilfs_tree_was_touched(s->s_root)) { | ||
1337 | busy = nilfs_try_to_shrink_tree(s->s_root); | ||
1338 | if (busy && (flags ^ s->s_flags) & MS_RDONLY) { | ||
1339 | printk(KERN_ERR "NILFS: the device already " | 1328 | printk(KERN_ERR "NILFS: the device already " |
1340 | "has a %s mount.\n", | 1329 | "has a %s mount.\n", |
1341 | (s->s_flags & MS_RDONLY) ? | 1330 | (s->s_flags & MS_RDONLY) ? |
@@ -1343,8 +1332,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1343 | err = -EBUSY; | 1332 | err = -EBUSY; |
1344 | goto failed_super; | 1333 | goto failed_super; |
1345 | } | 1334 | } |
1346 | } | 1335 | } else { |
1347 | if (!busy) { | ||
1348 | /* | 1336 | /* |
1349 | * Try remount to setup mount states if the current | 1337 | * Try remount to setup mount states if the current |
1350 | * tree is not mounted and only snapshots use this sb. | 1338 | * tree is not mounted and only snapshots use this sb. |