Skip to content

Commit

Permalink
block, bfq: return nbytes and not zero from struct cftype .write() me…
Browse files Browse the repository at this point in the history
…thod

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 <[email protected]>
Fixes: e21b7a0 ("block, bfq: add full hierarchical scheduling and cgroups support")
Cc: [email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
maciejsszmigiero authored and axboe committed Aug 16, 2018
1 parent f812164 commit fc8ebd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/bfq-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc8ebd0

Please sign in to comment.