From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:34330 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727090AbeI0Rl3 (ORCPT ); Thu, 27 Sep 2018 13:41:29 -0400 From: Jan Kara To: Dan Williams Cc: , linux-nvdimm@lists.01.org, Barret Rhoden , Jan Kara Subject: [PATCH] dax: Fix deadlock in dax_lock_mapping_entry() Date: Thu, 27 Sep 2018 13:23:32 +0200 Message-Id: <20180927112332.3649-1-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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: c2a7d2a115525d3501d38e23d24875a79a07e15e Reported-by: Barret Rhoden Signed-off-by: Jan Kara --- fs/dax.c | 1 + 1 file changed, 1 insertion(+) Dan, can you please get this merged? Otherwise dax_lock_mapping_entry() deadlocks as soon as there's any contention. diff --git a/fs/dax.c b/fs/dax.c index b68ce484e1be..4becbf168b7f 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; } -- 2.16.4