mirror of https://lore.kernel.org/lkml/
 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	[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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome