Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f9e3df8 authored by David Sterba's avatar David Sterba Committed by Chris Mason
Browse files

btrfs: replace error code from btrfs_drop_extents



There's a case which clone does not handle and used to BUG_ON instead,
(testcase xfstests/btrfs/035), now returns EINVAL. This error code is
confusing to the ioctl caller, as it normally signifies errorneous
arguments.

Change it to ENOPNOTSUPP which allows a fall back to copy instead of
clone. This does not affect the common reflink operation.

Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent c5f7d0bb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -805,7 +805,7 @@ next_slot:
		if (start > key.offset && end < extent_end) {
			BUG_ON(del_nr > 0);
			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
				ret = -EINVAL;
				ret = -EOPNOTSUPP;
				break;
			}

@@ -851,7 +851,7 @@ next_slot:
		 */
		if (start <= key.offset && end < extent_end) {
			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
				ret = -EINVAL;
				ret = -EOPNOTSUPP;
				break;
			}

@@ -877,7 +877,7 @@ next_slot:
		if (start > key.offset && end >= extent_end) {
			BUG_ON(del_nr > 0);
			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
				ret = -EINVAL;
				ret = -EOPNOTSUPP;
				break;
			}

+2 −2
Original line number Diff line number Diff line
@@ -3088,7 +3088,7 @@ process_slot:
							 new_key.offset + datal,
							 1);
				if (ret) {
					if (ret != -EINVAL)
					if (ret != -EOPNOTSUPP)
						btrfs_abort_transaction(trans,
								root, ret);
					btrfs_end_transaction(trans, root);
@@ -3163,7 +3163,7 @@ process_slot:
							 new_key.offset + datal,
							 1);
				if (ret) {
					if (ret != -EINVAL)
					if (ret != -EOPNOTSUPP)
						btrfs_abort_transaction(trans,
							root, ret);
					btrfs_end_transaction(trans, root);