From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH] libfs: return error code on failed attr set Date: Fri, 11 Sep 2009 18:50:31 +0800 Message-ID: <20090911105031.GA17315@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Theodore Ts'o , Al Viro , Christoph Hellwig , Nick Piggin , linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from mga03.intel.com ([143.182.124.21]:33205 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbZIKKvB (ORCPT ); Fri, 11 Sep 2009 06:51:01 -0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 CC: Al Viro CC: Christoph Hellwig CC: Nick Piggin Signed-off-by: Wu Fengguang --- 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;