Skip to content

Commit fc8ebd0

Browse files
maciejsszmigieroaxboe
authored andcommitted
block, bfq: return nbytes and not zero from struct cftype .write() method
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]>
1 parent f812164 commit fc8ebd0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/bfq-cgroup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,8 @@ static ssize_t bfq_io_set_weight(struct kernfs_open_file *of,
913913
if (ret)
914914
return ret;
915915

916-
return bfq_io_set_weight_legacy(of_css(of), NULL, weight);
916+
ret = bfq_io_set_weight_legacy(of_css(of), NULL, weight);
917+
return ret ?: nbytes;
917918
}
918919

919920
#ifdef CONFIG_DEBUG_BLK_CGROUP

0 commit comments

Comments
 (0)