diff options
author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2018-08-15 23:56:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-09 10:32:37 +0200 |
commit | 6ee996baf1ab28ae2f5f74f1f62e3bc488cc8f6a (patch) | |
tree | b4eda0d5ecd7e16c9ece7e964721f988bb44bb80 | |
parent | fbd0c9d27ccbb91c86df1f0ee453140caefea3d4 (diff) | |
download | linux-stable-6ee996baf1ab28ae2f5f74f1f62e3bc488cc8f6a.tar.gz linux-stable-6ee996baf1ab28ae2f5f74f1f62e3bc488cc8f6a.tar.bz2 linux-stable-6ee996baf1ab28ae2f5f74f1f62e3bc488cc8f6a.zip |
block, bfq: return nbytes and not zero from struct cftype .write() method
commit fc8ebd01deeb12728c83381f6ec923e4a192ffd3 upstream.
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
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | block/bfq-cgroup.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 |