btrfs: fix clone / extent-same deadlocks
authorMark Fasheh <mfasheh@suse.de>
Tue, 30 Jun 2015 21:42:06 +0000 (14:42 -0700)
committerChris Mason <clm@fb.com>
Sun, 9 Aug 2015 14:34:25 +0000 (07:34 -0700)
commit293a8489f300536dc6d996c35a6ebb89aa03bab2
treec428134cc3f86ec4e3dd48c413eee15995d5bfc0
parent4a3560c4f3f0f92d3b673944753e3e947e030bc4
btrfs: fix clone / extent-same deadlocks

Clone and extent same lock their source and target inodes in opposite order.
In addition to this, the range locking in clone doesn't take ordering into
account. Fix this by having clone use the same locking helpers as
btrfs-extent-same.

In addition, I do a small cleanup of the locking helpers, removing a case
(both inodes being the same) which was poorly accounted for and never
actually used by the callers.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c