From: Al Viro Date: Tue, 23 Mar 2010 00:15:33 +0000 (-0400) Subject: fix get_active_super()/umount() race X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1494583de59dfad2e3a6788ce9817e658d32df22;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git fix get_active_super()/umount() race This one needs restarts... Signed-off-by: Al Viro --- diff --git a/fs/super.c b/fs/super.c index 4df8233dfb61..44971d7df1ce 100644 --- a/fs/super.c +++ b/fs/super.c @@ -471,17 +471,17 @@ struct super_block *get_active_super(struct block_device *bdev) if (!bdev) return NULL; +restart: spin_lock(&sb_lock); list_for_each_entry(sb, &super_blocks, s_list) { if (list_empty(&sb->s_instances)) continue; - if (sb->s_bdev != bdev) - continue; - - if (grab_super(sb)) /* drops sb_lock */ - return sb; - - spin_lock(&sb_lock); + if (sb->s_bdev == bdev) { + if (grab_super(sb)) /* drops sb_lock */ + return sb; + else + goto restart; + } } spin_unlock(&sb_lock); return NULL;