diff mbox series

block, bfq: return nbytes and not zero from struct cftype .write() method

Message ID f574e019-00f2-96c3-fc32-541c6584ca96@maciej.szmigiero.name (mailing list archive)
State New, archived
Headers show
Series block, bfq: return nbytes and not zero from struct cftype .write() method | expand

Commit Message

Maciej S. Szmigiero Aug. 15, 2018, 9:56 p.m. UTC
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 <mail@maciej.szmigiero.name>
Fixes: e21b7a0b9887 ("block, bfq: add full hierarchical scheduling and cgroups support")
Cc: stable@vger.kernel.org
---
 block/bfq-cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jens Axboe Aug. 16, 2018, 7:11 p.m. UTC | #1
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.
Maciej S. Szmigiero Aug. 17, 2018, 5:27 p.m. UTC | #2
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
Jens Axboe Aug. 17, 2018, 5:38 p.m. UTC | #3
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.
Maciej S. Szmigiero Aug. 28, 2018, 2:38 p.m. UTC | #4
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
diff mbox series

Patch

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