Skip to contentSkip to conversation

btrfs: send: fix error code if an unknown inode type is found

PATCH In review David Sterba 3 participants 3 messages Sep 11, 2017 – Sep 12, 2017 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

PATCH 1/1 btrfs: send: fix error code if an unknown inode type is found

There are two types for "not supported", but the correct one is EOPNOTSUPP, let's use that one. The error message in the error case is not very helpful, enhance it at least with the inode number.

The unknown type seems to be the block device (S_IFBLK)(as it's the only unhandled case. Adding this type would need to extend the send protocol, so this needs to stay as 'not supported'.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196903

---
 fs/btrfs/send.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/send.c +3 -3
index 8f1d3d6e7087..5f944f9135d6 100644
@@ -2638,9 +2638,9 @@ static int send_create_inode(struct send_ctx *sctx, u64 ino)
 	} else if (S_ISSOCK(mode)) {
 		cmd = BTRFS_SEND_C_MKSOCK;
 	} else {
-		btrfs_warn(sctx->send_root->fs_info, "unexpected inode type %o",
-				(int)(mode & S_IFMT));
-		ret = -ENOTSUPP;
+		btrfs_warn(fs_info, "unexpected type 0%o of inode %llu",
+				(int)(mode & S_IFMT), ino);
+		ret = -EOPNOTSUPP;
 		goto out;
 	}
 
Signature · 1 line
2.14.0
Reviewed-by on v1 1/1
#1 lore raw

Hi David,

Quoted 3 lines · David Sterba

There are two types for "not supported", but the correct one is EOPNOTSUPP, let's use that one. The error message in the error case is not very helpful, enhance it at least with the inode number.

When I first posted a similar patch, you said "I'd rather make it EINVAL".
https://marc.info/?l=linux-btrfs&m=145342170820262&w=2

But I think that EOPNOTSUPP is also good.
So, anyway,

Quoted 29 lines

The unknown type seems to be the block device (S_IFBLK)(as it's the only unhandled case. Adding this type would need to extend the send protocol, so this needs to stay as 'not supported'.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196903

---
 fs/btrfs/send.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/send.c +3 -3
index 8f1d3d6e7087..5f944f9135d6 100644
@@ -2638,9 +2638,9 @@ static int send_create_inode(struct send_ctx *sctx, u64 ino)
 	} else if (S_ISSOCK(mode)) {
 		cmd = BTRFS_SEND_C_MKSOCK;
 	} else {
-		btrfs_warn(sctx->send_root->fs_info, "unexpected inode type %o",
-				(int)(mode & S_IFMT));
-		ret = -ENOTSUPP;
+		btrfs_warn(fs_info, "unexpected type 0%o of inode %llu",
+				(int)(mode & S_IFMT), ino);
+		ret = -EOPNOTSUPP;
 		goto out;
 	}
 
#2 lore raw
Quoted 9 lines · Tsutomu Itoh

Hi David,

Quoted 3 lines · David Sterba

There are two types for "not supported", but the correct one is EOPNOTSUPP, let's use that one. The error message in the error case is not very helpful, enhance it at least with the inode number.

When I first posted a similar patch, you said "I'd rather make it EINVAL".
https://marc.info/?l=linux-btrfs&m=145342170820262&w=2

So this patch got lost, thanks for pointing it out. I'll replace it and leave mine just updating the error message.