]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
block, bfq: return nbytes and not zero from struct cftype .write() method
authorMaciej S. Szmigiero <mail@maciej.szmigiero.name>
Wed, 15 Aug 2018 21:56:45 +0000 (23:56 +0200)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:45:54 +0000 (19:45 -0600)
BugLink: https://bugs.launchpad.net/bugs/1835972
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
block/bfq-cgroup.c

index d819dc77fe659e0adce9d8b4dd5107d47f2aae67..c5d8142368c70e0aaa6fbda915777b2b6d90882b 100644 (file)
@@ -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