Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1450764 > unrolled thread
| Started by | Tal Shorer <tal.shorer@gmail.com> |
|---|---|
| First post | 2016-07-26 20:30 +0200 |
| Last post | 2016-07-27 13:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] fs: configfs: don't set buffer_needs_fill to zero if show() returns error Tal Shorer <tal.shorer@gmail.com> - 2016-07-26 20:30 +0200
Re: [PATCH] fs: configfs: don't set buffer_needs_fill to zero if show() returns error Christoph Hellwig <hch@lst.de> - 2016-07-27 13:40 +0200
| From | Tal Shorer <tal.shorer@gmail.com> |
|---|---|
| Date | 2016-07-26 20:30 +0200 |
| Subject | Re: [PATCH] fs: configfs: don't set buffer_needs_fill to zero if show() returns error |
| Message-ID | <rZfh8-5uR-11@gated-at.bofh.it> |
On Fri, Jul 1, 2016 at 12:28 PM, Tal Shorer <tal.shorer@gmail.com> wrote:
> A confgifs attribute's show() callback is called once the first time
> the user attempts to read from it. If it returns an error, that
> error is returned to the user. However, the open file's
> buffer_needs_fill is still set to zero and consecutive read() calls
> will find an empty buffer that doesn't need filling and return 0 to
> the user. This could give the user the wrong impression that the
> attribute was read successfully.
>
> Fix this by not setting buffer_needs_fill if show() returns an error,
> making consecutive read() calls call show() again and either get an
> error again or get data.
>
> Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
> ---
> fs/configfs/file.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/configfs/file.c b/fs/configfs/file.c
> index 33b7ee3..68645c9 100644
> --- a/fs/configfs/file.c
> +++ b/fs/configfs/file.c
> @@ -80,11 +80,11 @@ static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buf
>
> count = attr->show(item, buffer->page);
>
> - buffer->needs_read_fill = 0;
> BUG_ON(count > (ssize_t)SIMPLE_ATTR_SIZE);
> - if (count >= 0)
> + if (count >= 0) {
> + buffer->needs_read_fill = 0;
> buffer->count = count;
> - else
> + } else
> ret = count;
> return ret;
> }
> --
> 2.7.4
>
Ping?
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Date | 2016-07-27 13:40 +0200 |
| Message-ID | <rZvlU-7fU-143@gated-at.bofh.it> |
| In reply to | #1450764 |
Hi Tal, I've queued up the patch a while ago, and it will go to Linus later this week.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web