Skip to content

Commit f52afc9

Browse files
jankaradjbw
authored andcommitted
dax: Fix deadlock in dax_lock_mapping_entry()
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 <brho@google.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 6bf4ca7 commit f52afc9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/dax.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ bool dax_lock_mapping_entry(struct page *page)
447447
xa_unlock_irq(&mapping->i_pages);
448448
break;
449449
} else if (IS_ERR(entry)) {
450+
xa_unlock_irq(&mapping->i_pages);
450451
WARN_ON_ONCE(PTR_ERR(entry) != -EAGAIN);
451452
continue;
452453
}

0 commit comments

Comments
 (0)