* [PATCH] btrfs: send: fix error code if an unknown inode type is found
@ 2017-09-11 16:58 David Sterba
2017-09-12 3:02 ` Tsutomu Itoh
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2017-09-11 16:58 UTC (permalink / raw)
To: linux-btrfs; +Cc: 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.
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
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/send.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 8f1d3d6e7087..5f944f9135d6 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -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.14.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: send: fix error code if an unknown inode type is found
2017-09-11 16:58 [PATCH] btrfs: send: fix error code if an unknown inode type is found David Sterba
@ 2017-09-12 3:02 ` Tsutomu Itoh
2017-09-12 11:13 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Tsutomu Itoh @ 2017-09-12 3:02 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs
Hi David,
On 2017/09/12 1:58, David Sterba wrote:
> 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,
Reviewed-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
>
> 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
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/send.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 8f1d3d6e7087..5f944f9135d6 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -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;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: send: fix error code if an unknown inode type is found
2017-09-12 3:02 ` Tsutomu Itoh
@ 2017-09-12 11:13 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2017-09-12 11:13 UTC (permalink / raw)
To: Tsutomu Itoh; +Cc: linux-btrfs
On Tue, Sep 12, 2017 at 12:02:44PM +0900, Tsutomu Itoh wrote:
> Hi David,
>
> On 2017/09/12 1:58, David Sterba wrote:
> > 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-12 11:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-11 16:58 [PATCH] btrfs: send: fix error code if an unknown inode type is found David Sterba
2017-09-12 3:02 ` Tsutomu Itoh
2017-09-12 11:13 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox