Skip to content

Commit

Permalink
logfs: fix deadlock in logfs_get_wblocks, hold and wait on super->s_w…
Browse files Browse the repository at this point in the history
…rite_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=20342

Signed-off-by: Prasad Joshi <[email protected]>
Cc: Joern Engel <[email protected]>
Cc: Florian Mickler <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Maciej Rutecki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Prasad Joshi authored and torvalds committed Dec 23, 2010
1 parent 7a2d19b commit eabb26c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/logfs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ void do_logfs_journal_wl_pass(struct super_block *sb)
super->s_journal_seg[i] = segno;
super->s_journal_ec[i] = ec;
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 */
err = logfs_erase_segment(sb, segno, 1);
BUG_ON(err); /* FIXME: remount-ro would be nicer */
Expand Down

0 comments on commit eabb26c

Please sign in to comment.