* [PATCH] libfs: return error code on failed attr set
@ 2009-09-11 10:50 Wu Fengguang
2009-09-11 18:29 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Wu Fengguang @ 2009-09-11 10:50 UTC (permalink / raw)
To: Andrew Morton
Cc: Theodore Ts'o, Al Viro, Christoph Hellwig, Nick Piggin,
linux-fsdevel
Currently all simple_attr.set handlers return 0 on success and negative
codes on error. Fix simple_attr_write() to return these error codes.
CC: Theodore Ts'o <tytso@mit.edu>
CC: Al Viro <viro@zeniv.linux.org.uk>
CC: Christoph Hellwig <hch@lst.de>
CC: Nick Piggin <npiggin@suse.de>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
fs/libfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- linux-mm.orig/fs/libfs.c 2009-09-08 16:28:59.000000000 +0800
+++ linux-mm/fs/libfs.c 2009-09-08 16:29:50.000000000 +0800
@@ -822,10 +822,11 @@ ssize_t simple_attr_write(struct file *f
if (copy_from_user(attr->set_buf, buf, size))
goto out;
- ret = len; /* claim we got the whole input */
attr->set_buf[size] = '\0';
val = simple_strtol(attr->set_buf, NULL, 0);
- attr->set(attr->data, val);
+ ret = attr->set(attr->data, val);
+ if (ret == 0)
+ ret = len; /* on success, claim we got the whole input */
out:
mutex_unlock(&attr->mutex);
return ret;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libfs: return error code on failed attr set
2009-09-11 10:50 [PATCH] libfs: return error code on failed attr set Wu Fengguang
@ 2009-09-11 18:29 ` Christoph Hellwig
2009-09-12 1:20 ` Wu Fengguang
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2009-09-11 18:29 UTC (permalink / raw)
To: Wu Fengguang
Cc: Andrew Morton, Theodore Ts'o, Al Viro, Christoph Hellwig,
Nick Piggin, linux-fsdevel
On Fri, Sep 11, 2009 at 06:50:31PM +0800, Wu Fengguang wrote:
> Currently all simple_attr.set handlers return 0 on success and negative
> codes on error. Fix simple_attr_write() to return these error codes.
Looks good to me assuming you actually audited all the implementations
to do the right thing.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libfs: return error code on failed attr set
2009-09-11 18:29 ` Christoph Hellwig
@ 2009-09-12 1:20 ` Wu Fengguang
0 siblings, 0 replies; 3+ messages in thread
From: Wu Fengguang @ 2009-09-12 1:20 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Andrew Morton, Theodore Ts'o, Al Viro, Nick Piggin,
linux-fsdevel@vger.kernel.org
On Sat, Sep 12, 2009 at 02:29:30AM +0800, Christoph Hellwig wrote:
> On Fri, Sep 11, 2009 at 06:50:31PM +0800, Wu Fengguang wrote:
> > Currently all simple_attr.set handlers return 0 on success and negative
> > codes on error. Fix simple_attr_write() to return these error codes.
>
> Looks good to me assuming you actually audited all the implementations
> to do the right thing.
Yes I checked all DEFINE_SIMPLE_ATTRIBUTE users. All the _set()
handlers returns 0 for success and negative error code for failure.
Thanks,
Fengguang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-12 1:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-11 10:50 [PATCH] libfs: return error code on failed attr set Wu Fengguang
2009-09-11 18:29 ` Christoph Hellwig
2009-09-12 1:20 ` Wu Fengguang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).