From c45a80e82eb6d4a8d2023fb1844d052da65b8014 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Tue, 2 Jan 2007 08:48:08 +0100 Subject: [PATCH] --- yaml --- r: 46622 b: refs/heads/master c: 82244b169ed2eee1ef7f97a3a6693f5a6eff8a69 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/sysfs/file.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index feff7215f46f..1b67dea89e3e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b067db49e1f4013ef02ef68845701b600e88a722 +refs/heads/master: 82244b169ed2eee1ef7f97a3a6693f5a6eff8a69 diff --git a/trunk/fs/sysfs/file.c b/trunk/fs/sysfs/file.c index 46618f81ae48..c0e117649a4d 100644 --- a/trunk/fs/sysfs/file.c +++ b/trunk/fs/sysfs/file.c @@ -83,7 +83,8 @@ remove_from_collection(struct sysfs_buffer *buffer, struct inode *node) * Allocate @buffer->page, if it hasn't been already, then call the * kobject's show() method to fill the buffer with this attribute's * data. - * This is called only once, on the file's first read. + * This is called only once, on the file's first read unless an error + * is returned. */ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) { @@ -101,12 +102,13 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer buffer->event = atomic_read(&sd->s_event); count = ops->show(kobj,attr,buffer->page); - buffer->needs_read_fill = 0; BUG_ON(count > (ssize_t)PAGE_SIZE); - if (count >= 0) + if (count >= 0) { + buffer->needs_read_fill = 0; buffer->count = count; - else + } else { ret = count; + } return ret; }