From: Jan Kara Date: Thu, 27 Sep 2018 11:23:32 +0000 (+0200) Subject: dax: Fix deadlock in dax_lock_mapping_entry() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f52afc93cd018fe6910133a05d44671192d1aeb0;p=openwrt%2Fstaging%2Fblogic.git 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: c2a7d2a11552 ("filesystem-dax: Introduce dax_lock_mapping_entry()") Reported-by: Barret Rhoden Signed-off-by: Jan Kara Signed-off-by: Dan Williams --- diff --git a/fs/dax.c b/fs/dax.c index f32d7125ad0f..e4ef8af31aa6 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -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; }