From: Chris Mason <clm@fb.com>
Date: Mon, 7 Apr 2014 14:10:40 +0000 (-0700)
Subject: Btrfs: fix EINVAL checks in btrfs_clone
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3a29bc0928003674f45b4fe625b4d0738a22c60d;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

Btrfs: fix EINVAL checks in btrfs_clone

btrfs_drop_extents can now return -EINVAL, but only one caller
in btrfs_clone was checking for it.  This adds it to the
caller for inline extents, which is where we really need it.

Signed-off-by: Chris Mason <clm@fb.com>
---

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 05f8df866e4c..89d5db7eb452 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3163,8 +3163,9 @@ process_slot:
 							 new_key.offset + datal,
 							 1);
 				if (ret) {
-					btrfs_abort_transaction(trans, root,
-								ret);
+					if (ret != -EINVAL)
+						btrfs_abort_transaction(trans,
+							root, ret);
 					btrfs_end_transaction(trans, root);
 					goto out;
 				}