Commit eabb26ca authored by Prasad Joshi's avatar Prasad Joshi Committed by Linus Torvalds

logfs: fix deadlock in logfs_get_wblocks, hold and wait on super->s_write_mutex

do_logfs_journal_wl_pass() should use GFP_NOFS for memory allocation GC
code calls btree_insert32 with GFP_KERNEL while holding a mutex
super->s_write_mutex.

The same mutex is used in address_space_operations->writepage(), and a
call to writepage() could be triggered as a result of memory allocation
in btree_insert32, causing a deadlock.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=20342Signed-off-by: default avatarPrasad Joshi <prasadjoshi124@gmail.com>
Cc: Joern Engel <joern@logfs.org>
Cc: Florian Mickler <florian@mickler.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Maciej Rutecki <maciej.rutecki@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7a2d19bc
...@@ -828,7 +828,7 @@ void do_logfs_journal_wl_pass(struct super_block *sb) ...@@ -828,7 +828,7 @@ void do_logfs_journal_wl_pass(struct super_block *sb)
super->s_journal_seg[i] = segno; super->s_journal_seg[i] = segno;
super->s_journal_ec[i] = ec; super->s_journal_ec[i] = ec;
logfs_set_segment_reserved(sb, segno); logfs_set_segment_reserved(sb, segno);
err = btree_insert32(head, segno, (void *)1, GFP_KERNEL); err = btree_insert32(head, segno, (void *)1, GFP_NOFS);
BUG_ON(err); /* mempool should prevent this */ BUG_ON(err); /* mempool should prevent this */
err = logfs_erase_segment(sb, segno, 1); err = logfs_erase_segment(sb, segno, 1);
BUG_ON(err); /* FIXME: remount-ro would be nicer */ BUG_ON(err); /* FIXME: remount-ro would be nicer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment