Btrfs: fix lockdep warning about log_mutex
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 1 Dec 2016 00:20:25 +0000 (16:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Aug 2017 01:59:47 +0000 (18:59 -0700)
commit6731212836059c7ac3575e21c499380e795516a9
tree526a24225b8c7dfd0570ea3f0c359f1619b192e1
parent78418b86733462c913aea82e081594b1005751ba
Btrfs: fix lockdep warning about log_mutex

[ Upstream commit 781feef7e6befafd4d9787d1f7ada1f9ccd504e4 ]

While checking INODE_REF/INODE_EXTREF for a corner case, we may acquire a
different inode's log_mutex with holding the current inode's log_mutex, and
lockdep has complained this with a possilble deadlock warning.

Fix this by using mutex_lock_nested() when processing the other inode's
log_mutex.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/tree-log.c