diff options
author | Jan Kara <jack@suse.cz> | 2012-02-10 05:03:00 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-02-13 20:45:38 -0500 |
commit | 6b6dc836a195e077e76977b6c020a73de411b46d (patch) | |
tree | 59920a3aab6db4997f6b7a95c753219bdc12bd64 /fs/super.c | |
parent | 074b85175a43a23fdbde60f55feea636e0bf0f85 (diff) |
vfs: Provide function to get superblock and wait for it to thaw
In quota code we need to find a superblock corresponding to a device and wait
for superblock to be unfrozen. However this waiting has to happen without
s_umount semaphore because that is required for superblock to thaw. So provide
a function in VFS for this to keep dances with s_umount where they belong.
[AV: implementation switched to saner variant]
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/super.c b/fs/super.c index 6015c02296b7..6277ec6cb60a 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -634,6 +634,28 @@ rescan: | |||
634 | EXPORT_SYMBOL(get_super); | 634 | EXPORT_SYMBOL(get_super); |
635 | 635 | ||
636 | /** | 636 | /** |
637 | * get_super_thawed - get thawed superblock of a device | ||
638 | * @bdev: device to get the superblock for | ||
639 | * | ||
640 | * Scans the superblock list and finds the superblock of the file system | ||
641 | * mounted on the device. The superblock is returned once it is thawed | ||
642 | * (or immediately if it was not frozen). %NULL is returned if no match | ||
643 | * is found. | ||
644 | */ | ||
645 | struct super_block *get_super_thawed(struct block_device *bdev) | ||
646 | { | ||
647 | while (1) { | ||
648 | struct super_block *s = get_super(bdev); | ||
649 | if (!s || s->s_frozen == SB_UNFROZEN) | ||
650 | return s; | ||
651 | up_read(&s->s_umount); | ||
652 | vfs_check_frozen(s, SB_FREEZE_WRITE); | ||
653 | put_super(s); | ||
654 | } | ||
655 | } | ||
656 | EXPORT_SYMBOL(get_super_thawed); | ||
657 | |||
658 | /** | ||
637 | * get_active_super - get an active reference to the superblock of a device | 659 | * get_active_super - get an active reference to the superblock of a device |
638 | * @bdev: device to get the superblock for | 660 | * @bdev: device to get the superblock for |
639 | * | 661 | * |