浏览代码

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 <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>
Maciej S. Szmigiero 7 年之前
父节点
当前提交
fc8ebd01de
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      block/bfq-cgroup.c

+ 2 - 1
block/bfq-cgroup.c

@@ -913,7 +913,8 @@ static ssize_t bfq_io_set_weight(struct kernfs_open_file *of,
 	if (ret)
 	if (ret)
 		return 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
 #ifdef CONFIG_DEBUG_BLK_CGROUP