2018-08-15 22:17:05

by Maciej S. Szmigiero

[permalink] [raw]
Subject: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method

The value that struct cftype .write() method returns is then directly
returned to userspace as the value returned by write() syscall, so it
should be the number of bytes actually written (or consumed) and not zero.

Returning zero from write() syscall makes programs like /bin/echo or bash
spin.

Signed-off-by: Maciej S. Szmigiero <[email protected]>
Fixes: e21b7a0b9887 ("block, bfq: add full hierarchical scheduling and cgroups support")
Cc: [email protected]
---
block/bfq-cgroup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index a9e8633388f4..58c6efa9f9a9 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -913,7 +913,8 @@ static ssize_t bfq_io_set_weight(struct kernfs_open_file *of,
if (ret)
return ret;

- return bfq_io_set_weight_legacy(of_css(of), NULL, weight);
+ ret = bfq_io_set_weight_legacy(of_css(of), NULL, weight);
+ return ret ?: nbytes;
}

#ifdef CONFIG_DEBUG_BLK_CGROUP


2018-08-16 19:14:03

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method

On 8/15/18 3:56 PM, Maciej S. Szmigiero wrote:
> The value that struct cftype .write() method returns is then directly
> returned to userspace as the value returned by write() syscall, so it
> should be the number of bytes actually written (or consumed) and not zero.
>
> Returning zero from write() syscall makes programs like /bin/echo or bash
> spin.

Applied, thanks.

Just a heads-up that gmail thinks your email is spam.

--
Jens Axboe


2018-08-17 17:28:43

by Maciej S. Szmigiero

[permalink] [raw]
Subject: Re: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method

On 16.08.2018 21:11, Jens Axboe wrote:
> On 8/15/18 3:56 PM, Maciej S. Szmigiero wrote:
>> The value that struct cftype .write() method returns is then directly
>> returned to userspace as the value returned by write() syscall, so it
>> should be the number of bytes actually written (or consumed) and not zero.
>>
>> Returning zero from write() syscall makes programs like /bin/echo or bash
>> spin.
>
> Applied, thanks.

Thanks.

> Just a heads-up that gmail thinks your email is spam.

Thanks for the information - it looks like gmail just doesn't like my
email server for some reason.

Maciej

2018-08-17 17:46:23

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method

On 8/17/18 11:27 AM, Maciej S. Szmigiero wrote:
> On 16.08.2018 21:11, Jens Axboe wrote:
>> On 8/15/18 3:56 PM, Maciej S. Szmigiero wrote:
>>> The value that struct cftype .write() method returns is then directly
>>> returned to userspace as the value returned by write() syscall, so it
>>> should be the number of bytes actually written (or consumed) and not zero.
>>>
>>> Returning zero from write() syscall makes programs like /bin/echo or bash
>>> spin.
>>
>> Applied, thanks.
>
> Thanks.
>
>> Just a heads-up that gmail thinks your email is spam.
>
> Thanks for the information - it looks like gmail just doesn't like my
> email server for some reason.

This one came through fine, jfyi.

--
Jens Axboe


2018-08-28 14:41:13

by Maciej S. Szmigiero

[permalink] [raw]
Subject: (Was: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method)

On 17.08.2018 19:38, Jens Axboe wrote:
> On 8/17/18 11:27 AM, Maciej S. Szmigiero wrote:
>> On 16.08.2018 21:11, Jens Axboe wrote:
>>> Just a heads-up that gmail thinks your email is spam.
>>
>> Thanks for the information - it looks like gmail just doesn't like my
>> email server for some reason.
>
> This one came through fine, jfyi.

Were my two patches from 17.08 able to make it through the filter?

Thanks,
Maciej