* [PATCH 0/1] btrfs-progs: send: fail on first -ENODATA only
[not found] <df7120cc-82a9-a90d-8832-e1767ba65d69@mokrynskyi.com,CAKuJGC88jCxHBz6eTNK-F-fsuBzw4jRsDucEYqgPRKrgR8TWWA@mail.gmail.com,20170428095530.yw74untb34oawlm2@mailbox.org>
@ 2017-04-29 21:54 ` Christian Brauner
2017-04-29 21:54 ` [PATCH 1/1] " Christian Brauner
0 siblings, 1 reply; 5+ messages in thread
From: Christian Brauner @ 2017-04-29 21:54 UTC (permalink / raw)
To: nazar, lakshmipathi.g, dsterba, linux-btrfs; +Cc: Christian Brauner
Christian Brauner (1):
btrfs-progs: send: fail on first -ENODATA only
cmds-receive.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] btrfs-progs: send: fail on first -ENODATA only
2017-04-29 21:54 ` [PATCH 0/1] btrfs-progs: send: fail on first -ENODATA only Christian Brauner
@ 2017-04-29 21:54 ` Christian Brauner
2017-05-01 13:09 ` Christian Brauner
0 siblings, 1 reply; 5+ messages in thread
From: Christian Brauner @ 2017-04-29 21:54 UTC (permalink / raw)
To: nazar, lakshmipathi.g, dsterba, linux-btrfs; +Cc: Christian Brauner
Returning -ENODATA is only considered invalid on the first run of the loop.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
cmds-receive.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/cmds-receive.c b/cmds-receive.c
index b59f00e4..72e9c8f3 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -1091,6 +1091,7 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
char *dest_dir_full_path;
char root_subvol_path[PATH_MAX];
int end = 0;
+ int iterations = 0;
dest_dir_full_path = realpath(tomnt, NULL);
if (!dest_dir_full_path) {
@@ -1198,13 +1199,18 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
rctx,
rctx->honor_end_cmd,
max_errors);
- if (ret < 0 && ret == -ENODATA) {
+ if (ret < 0) {
+ if (ret != -ENODATA)
+ goto out;
+
/* Empty stream is invalid */
- error("empty stream is not considered valid");
- ret = -EINVAL;
- goto out;
- } else if (ret < 0) {
- goto out;
+ if (iterations == 0) {
+ error("empty stream is not considered valid");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ ret = 1;
}
if (ret > 0)
end = 1;
@@ -1213,6 +1219,8 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
ret = finish_subvol(rctx);
if (ret < 0)
goto out;
+
+ iterations++;
}
ret = 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] btrfs-progs: send: fail on first -ENODATA only
2017-04-29 21:54 ` [PATCH 1/1] " Christian Brauner
@ 2017-05-01 13:09 ` Christian Brauner
2017-05-01 18:16 ` Lakshmipathi.G
2017-05-09 18:09 ` David Sterba
0 siblings, 2 replies; 5+ messages in thread
From: Christian Brauner @ 2017-05-01 13:09 UTC (permalink / raw)
To: Christian Brauner; +Cc: nazar, lakshmipathi.g, dsterba, linux-btrfs
Hi,
The original bug-reporter verified that my patch fixes the bug. See
https://bugzilla.kernel.org/show_bug.cgi?id=195597
Christian
On Sat, Apr 29, 2017 at 11:54:05PM +0200, Christian Brauner wrote:
> Returning -ENODATA is only considered invalid on the first run of the loop.
>
> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
> ---
> cmds-receive.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/cmds-receive.c b/cmds-receive.c
> index b59f00e4..72e9c8f3 100644
> --- a/cmds-receive.c
> +++ b/cmds-receive.c
> @@ -1091,6 +1091,7 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
> char *dest_dir_full_path;
> char root_subvol_path[PATH_MAX];
> int end = 0;
> + int iterations = 0;
>
> dest_dir_full_path = realpath(tomnt, NULL);
> if (!dest_dir_full_path) {
> @@ -1198,13 +1199,18 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
> rctx,
> rctx->honor_end_cmd,
> max_errors);
> - if (ret < 0 && ret == -ENODATA) {
> + if (ret < 0) {
> + if (ret != -ENODATA)
> + goto out;
> +
> /* Empty stream is invalid */
> - error("empty stream is not considered valid");
> - ret = -EINVAL;
> - goto out;
> - } else if (ret < 0) {
> - goto out;
> + if (iterations == 0) {
> + error("empty stream is not considered valid");
> + ret = -EINVAL;
> + goto out;
> + }
> +
> + ret = 1;
> }
> if (ret > 0)
> end = 1;
> @@ -1213,6 +1219,8 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
> ret = finish_subvol(rctx);
> if (ret < 0)
> goto out;
> +
> + iterations++;
> }
> ret = 0;
>
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] btrfs-progs: send: fail on first -ENODATA only
2017-05-01 13:09 ` Christian Brauner
@ 2017-05-01 18:16 ` Lakshmipathi.G
2017-05-09 18:09 ` David Sterba
1 sibling, 0 replies; 5+ messages in thread
From: Lakshmipathi.G @ 2017-05-01 18:16 UTC (permalink / raw)
To: Christian Brauner; +Cc: Christian Brauner, Nazar Mokrynskyi, dsterba, btrfs
Hi Christian, thanks for fixing it quickly :) I don't have permission
to change the bug state to fixed, if you or Nazar have those rights, i
think this bug can be closed.
----
Cheers,
Lakshmipathi.G
http://www.giis.co.in http://www.webminal.org
On Mon, May 1, 2017 at 6:39 PM, Christian Brauner
<christian.brauner@canonical.com> wrote:
> Hi,
>
> The original bug-reporter verified that my patch fixes the bug. See
>
> https://bugzilla.kernel.org/show_bug.cgi?id=195597
>
> Christian
>
> On Sat, Apr 29, 2017 at 11:54:05PM +0200, Christian Brauner wrote:
>> Returning -ENODATA is only considered invalid on the first run of the loop.
>>
>> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
>> ---
>> cmds-receive.c | 20 ++++++++++++++------
>> 1 file changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/cmds-receive.c b/cmds-receive.c
>> index b59f00e4..72e9c8f3 100644
>> --- a/cmds-receive.c
>> +++ b/cmds-receive.c
>> @@ -1091,6 +1091,7 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
>> char *dest_dir_full_path;
>> char root_subvol_path[PATH_MAX];
>> int end = 0;
>> + int iterations = 0;
>>
>> dest_dir_full_path = realpath(tomnt, NULL);
>> if (!dest_dir_full_path) {
>> @@ -1198,13 +1199,18 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
>> rctx,
>> rctx->honor_end_cmd,
>> max_errors);
>> - if (ret < 0 && ret == -ENODATA) {
>> + if (ret < 0) {
>> + if (ret != -ENODATA)
>> + goto out;
>> +
>> /* Empty stream is invalid */
>> - error("empty stream is not considered valid");
>> - ret = -EINVAL;
>> - goto out;
>> - } else if (ret < 0) {
>> - goto out;
>> + if (iterations == 0) {
>> + error("empty stream is not considered valid");
>> + ret = -EINVAL;
>> + goto out;
>> + }
>> +
>> + ret = 1;
>> }
>> if (ret > 0)
>> end = 1;
>> @@ -1213,6 +1219,8 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
>> ret = finish_subvol(rctx);
>> if (ret < 0)
>> goto out;
>> +
>> + iterations++;
>> }
>> ret = 0;
>>
>> --
>> 2.11.0
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] btrfs-progs: send: fail on first -ENODATA only
2017-05-01 13:09 ` Christian Brauner
2017-05-01 18:16 ` Lakshmipathi.G
@ 2017-05-09 18:09 ` David Sterba
1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-05-09 18:09 UTC (permalink / raw)
To: Christian Brauner
Cc: Christian Brauner, nazar, lakshmipathi.g, dsterba, linux-btrfs
On Mon, May 01, 2017 at 03:09:41PM +0200, Christian Brauner wrote:
> The original bug-reporter verified that my patch fixes the bug. See
>
> https://bugzilla.kernel.org/show_bug.cgi?id=195597
Thanks, patch applied. I'll add reference to the changelog.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-09 18:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <df7120cc-82a9-a90d-8832-e1767ba65d69@mokrynskyi.com,CAKuJGC88jCxHBz6eTNK-F-fsuBzw4jRsDucEYqgPRKrgR8TWWA@mail.gmail.com,20170428095530.yw74untb34oawlm2@mailbox.org>
2017-04-29 21:54 ` [PATCH 0/1] btrfs-progs: send: fail on first -ENODATA only Christian Brauner
2017-04-29 21:54 ` [PATCH 1/1] " Christian Brauner
2017-05-01 13:09 ` Christian Brauner
2017-05-01 18:16 ` Lakshmipathi.G
2017-05-09 18:09 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.