The thaw_super_locked() expects the caller to hold the sb->s_umount semaphore. It also handles the unlocking of the semaphore for you. Allow for cases where the caller will do the unlocking of the semaphore. Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx> --- fs/super.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/super.c b/fs/super.c index 72b445a69a45..744b2399a272 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1730,14 +1730,13 @@ int freeze_super(struct super_block *sb) } EXPORT_SYMBOL(freeze_super); -static int thaw_super_locked(struct super_block *sb) +/* Caller deals with the sb->s_umount */ +static int __thaw_super_locked(struct super_block *sb) { int error; - if (!sb_is_frozen(sb)) { - up_write(&sb->s_umount); + if (!sb_is_frozen(sb)) return -EINVAL; - } if (sb_rdonly(sb)) { sb->s_writers.frozen = SB_UNFROZEN; @@ -1752,7 +1751,6 @@ static int thaw_super_locked(struct super_block *sb) printk(KERN_ERR "VFS:Filesystem thaw failed\n"); lockdep_sb_freeze_release(sb); - up_write(&sb->s_umount); return error; } } @@ -1761,10 +1759,25 @@ static int thaw_super_locked(struct super_block *sb) sb_freeze_unlock(sb); out: wake_up(&sb->s_writers.wait_unfrozen); - deactivate_locked_super(sb); return 0; } +/* Handles unlocking of sb->s_umount for you */ +static int thaw_super_locked(struct super_block *sb) +{ + int error; + + error = __thaw_super_locked(sb); + if (error) { + up_write(&sb->s_umount); + return error; + } + + deactivate_locked_super(sb); + + return 0; + } + /** * thaw_super -- unlock filesystem * @sb: the super to thaw -- 2.29.2