The emergency thaw process uses iterate_super() which holds the sb->s_umount lock in read mode. The current thaw_super() code takes the sb->s_umount lock in write mode, hence leading to an instant deadlock. Use the unlocked version of thaw_super() to do the thawing and replace iterate_supers() with __iterate_supers() so that the unfreeze operation can be performed with s_umount held as the locking rules for fsfreeze indicate. Cc: Josef Bacik <jbacik@xxxxxxxxxxxx> Cc: Eric Sandeen <sandeen@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Cc: Dave Chinner <dchinner@xxxxxxxxxx> Signed-off-by: Fernando Luis Vazquez Cao <fernando@xxxxxxxxxxxxx> --- diff -urNp linux-3.6-rc5-orig/fs/buffer.c linux-3.6-rc5/fs/buffer.c --- linux-3.6-rc5-orig/fs/buffer.c 2012-09-12 20:23:59.146047001 +0900 +++ linux-3.6-rc5/fs/buffer.c 2012-09-12 20:33:35.994042452 +0900 @@ -511,17 +511,32 @@ repeat: return err; } +static int thaw_super_emergency(struct super_block *sb) +{ + int res; + /* We were called from __iterate_supers with superblock lock taken + * so we do not need to do it here. */ + res = __thaw_super(sb); + if (!res) + deactivate_locked_super(sb); + else + up_write(&sb->s_umount); + return res; +} + static void do_thaw_one(struct super_block *sb, void *unused) { - char b[BDEVNAME_SIZE]; - while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb)) - printk(KERN_WARNING "Emergency Thaw on %s\n", + if (sb->s_bdev) { + char b[BDEVNAME_SIZE]; + printk(KERN_WARNING "Emergency Thaw on %s.\n", bdevname(sb->s_bdev, b)); + } + while (!thaw_super_emergency(sb)); } static void do_thaw_all(struct work_struct *work) { - iterate_supers(do_thaw_one, NULL); + __iterate_supers(do_thaw_one, NULL, true); kfree(work); printk(KERN_WARNING "Emergency Thaw complete\n"); } -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html