diff options
author | Konstantin Khlebnikov <khlebnikov@yandex-team.ru> | 2016-06-22 21:42:16 +0300 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-09-15 18:53:30 -0400 |
commit | 8f96009a9d8e8085278e692764a38f52011fd2c4 (patch) | |
tree | f00b9e0433b5a47808091b17f048c77cc7b59281 /fs/fscache | |
parent | f53680b1d8b0f1cd039b5328d194b8e72973919f (diff) |
sysfs: correctly handle read offset on PREALLOC attrs
[ Upstream commit 17d0774f80681020eccc9638d925a23f1fc4f671 ]
Attributes declared with __ATTR_PREALLOC use sysfs_kf_read() which returns
zero bytes for non-zero offset. This breaks script checkarray in mdadm tool
in debian where /bin/sh is 'dash' because its builtin 'read' reads only one
byte at a time. Script gets 'i' instead of 'idle' when reads current action
from /sys/block/$dev/md/sync_action and as a result does nothing.
This patch adds trivial implementation of partial read: generate whole
string and move required part into buffer head.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 4ef67a8c95f3 ("sysfs/kernfs: make read requests on pre-alloc files use the buffer.")
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787950
Cc: Stable <stable@vger.kernel.org> # v3.19+
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'fs/fscache')
0 files changed, 0 insertions, 0 deletions