lkml.org 
[lkml]   [2016]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sysfs: correctly handle read offset on PREALLOC attrs
On Wed, Jun 22, 2016 at 09:42:16PM +0300, Konstantin Khlebnikov wrote:
> 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>

Thanks.

--
tejun

\
 
 \ /
  Last update: 2016-06-24 00:01    [W:1.576 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site