Browse files

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


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

Signed-off-by: Maciej S. Szmigiero <>
Fixes: e21b7a0 ("block, bfq: add full hierarchical scheduling and cgroups support")
Signed-off-by: Jens Axboe <>
Signed-off-by: Greg Kroah-Hartman <>
  • Loading branch information...
maciejsszmigiero authored and gregkh committed Aug 15, 2018
1 parent fe806eb commit ed480f2b9e86102b5d57fcd708915ae4f34add5b
Showing with 2 additions and 1 deletion.
  1. +2 −1 block/bfq-cgroup.c
@@ -887,7 +887,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;
static int bfqg_print_stat(struct seq_file *sf, void *v)

0 comments on commit ed480f2

Please sign in to comment.