mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
074b85175a
commit
6b6dc836a1
2 changed files with 23 additions and 0 deletions
22
fs/super.c
22
fs/super.c
|
|
@ -633,6 +633,28 @@ rescan:
|
|||
|
||||
EXPORT_SYMBOL(get_super);
|
||||
|
||||
/**
|
||||
* get_super_thawed - get thawed superblock of a device
|
||||
* @bdev: device to get the superblock for
|
||||
*
|
||||
* Scans the superblock list and finds the superblock of the file system
|
||||
* mounted on the device. The superblock is returned once it is thawed
|
||||
* (or immediately if it was not frozen). %NULL is returned if no match
|
||||
* is found.
|
||||
*/
|
||||
struct super_block *get_super_thawed(struct block_device *bdev)
|
||||
{
|
||||
while (1) {
|
||||
struct super_block *s = get_super(bdev);
|
||||
if (!s || s->s_frozen == SB_UNFROZEN)
|
||||
return s;
|
||||
up_read(&s->s_umount);
|
||||
vfs_check_frozen(s, SB_FREEZE_WRITE);
|
||||
put_super(s);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(get_super_thawed);
|
||||
|
||||
/**
|
||||
* get_active_super - get an active reference to the superblock of a device
|
||||
* @bdev: device to get the superblock for
|
||||
|
|
|
|||
Loading…
Reference in a new issue