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. As a bonus, by using thaw_super(), which does not nest, instead of thaw_bdev() when can get rid of the ugly while loop. 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-14 12:46:22.988871880 +0900 +++ linux-3.6-rc5/fs/buffer.c 2012-09-14 13:05:47.812919103 +0900 @@ -513,15 +513,27 @@ repeat: 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", + int res; + + if (sb->s_bdev) { + char b[BDEVNAME_SIZE]; + printk(KERN_WARNING "Emergency Thaw on %s.\n", bdevname(sb->s_bdev, b)); + } + + /* 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_all(struct work_struct *work) { - iterate_supers_read(do_thaw_one, NULL); + iterate_supers_write(do_thaw_one, NULL); 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