Skip to content

Commit

Permalink
dax: Fix deadlock in dax_lock_mapping_entry()
Browse files Browse the repository at this point in the history
When dax_lock_mapping_entry() has to sleep to obtain entry lock, it will
fail to unlock mapping->i_pages spinlock and thus immediately deadlock
against itself when retrying to grab the entry lock again. Fix the
problem by unlocking mapping->i_pages before retrying.

Fixes: c2a7d2a ("filesystem-dax: Introduce dax_lock_mapping_entry()")
Reported-by: Barret Rhoden <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
jankara authored and djbw committed Sep 27, 2018
1 parent 6bf4ca7 commit f52afc9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ bool dax_lock_mapping_entry(struct page *page)
xa_unlock_irq(&mapping->i_pages);
break;
} else if (IS_ERR(entry)) {
xa_unlock_irq(&mapping->i_pages);
WARN_ON_ONCE(PTR_ERR(entry) != -EAGAIN);
continue;
}
Expand Down

0 comments on commit f52afc9

Please sign in to comment.