dax: Fix deadlock in dax_lock_mapping_entry()
authorJan Kara <jack@suse.cz>
Thu, 27 Sep 2018 11:23:32 +0000 (13:23 +0200)
committerDan Williams <dan.j.williams@intel.com>
Thu, 27 Sep 2018 17:56:15 +0000 (10:56 -0700)
commitf52afc93cd018fe6910133a05d44671192d1aeb0
tree32137752634c7f3c0f4efecfc91d64551bed047c
parent6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84
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 <brho@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
fs/dax.c