All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method
@ 2018-08-15 21:56 Maciej S. Szmigiero
  2018-08-16 19:11 ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Maciej S. Szmigiero @ 2018-08-15 21:56 UTC (permalink / raw)
  To: Paolo Valente, Jens Axboe; +Cc: linux-block, linux-kernel, Arianna Avanzini

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(-)

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method
  2018-08-15 21:56 [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method Maciej S. Szmigiero
@ 2018-08-16 19:11 ` Jens Axboe
  2018-08-17 17:27   ` Maciej S. Szmigiero
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2018-08-16 19:11 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Paolo Valente
  Cc: linux-block, linux-kernel, Arianna Avanzini

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method
  2018-08-16 19:11 ` Jens Axboe
@ 2018-08-17 17:27   ` Maciej S. Szmigiero
  2018-08-17 17:38     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Maciej S. Szmigiero @ 2018-08-17 17:27 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Paolo Valente, linux-block, linux-kernel, Arianna Avanzini

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method
  2018-08-17 17:27   ` Maciej S. Szmigiero
@ 2018-08-17 17:38     ` Jens Axboe
  2018-08-28 14:38       ` (Was: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method) Maciej S. Szmigiero
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2018-08-17 17:38 UTC (permalink / raw)
  To: Maciej S. Szmigiero
  Cc: Paolo Valente, linux-block, linux-kernel, Arianna Avanzini

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* (Was: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method)
  2018-08-17 17:38     ` Jens Axboe
@ 2018-08-28 14:38       ` Maciej S. Szmigiero
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej S. Szmigiero @ 2018-08-28 14:38 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Paolo Valente, linux-block, linux-kernel, Arianna Avanzini

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-28 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 21:56 [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method Maciej S. Szmigiero
2018-08-16 19:11 ` Jens Axboe
2018-08-17 17:27   ` Maciej S. Szmigiero
2018-08-17 17:38     ` Jens Axboe
2018-08-28 14:38       ` (Was: [PATCH] block, bfq: return nbytes and not zero from struct cftype .write() method) Maciej S. Szmigiero

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.