aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/sysfs/file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 46618f81ae48..c0e117649a4d 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -83,7 +83,8 @@ remove_from_collection(struct sysfs_buffer *buffer, struct inode *node)
83 * Allocate @buffer->page, if it hasn't been already, then call the 83 * Allocate @buffer->page, if it hasn't been already, then call the
84 * kobject's show() method to fill the buffer with this attribute's 84 * kobject's show() method to fill the buffer with this attribute's
85 * data. 85 * data.
86 * This is called only once, on the file's first read. 86 * This is called only once, on the file's first read unless an error
87 * is returned.
87 */ 88 */
88static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) 89static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer)
89{ 90{
@@ -101,12 +102,13 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
101 102
102 buffer->event = atomic_read(&sd->s_event); 103 buffer->event = atomic_read(&sd->s_event);
103 count = ops->show(kobj,attr,buffer->page); 104 count = ops->show(kobj,attr,buffer->page);
104 buffer->needs_read_fill = 0;
105 BUG_ON(count > (ssize_t)PAGE_SIZE); 105 BUG_ON(count > (ssize_t)PAGE_SIZE);
106 if (count >= 0) 106 if (count >= 0) {
107 buffer->needs_read_fill = 0;
107 buffer->count = count; 108 buffer->count = count;
108 else 109 } else {
109 ret = count; 110 ret = count;
111 }
110 return ret; 112 return ret;
111} 113}
112 114