From patchwork Mon Oct 21 19:47:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geyslan G. Bem" X-Patchwork-Id: 3079471 Return-Path: X-Original-To: patchwork-v9fs-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D3AE9BF924 for ; Mon, 21 Oct 2013 19:52:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1013720334 for ; Mon, 21 Oct 2013 19:52:56 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04779202DD for ; Mon, 21 Oct 2013 19:52:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VYLX2-0003o7-Ut; Mon, 21 Oct 2013 19:52:53 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VYLX1-0003nw-KE for v9fs-developer@lists.sourceforge.net; Mon, 21 Oct 2013 19:52:51 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.161.173 as permitted sender) client-ip=209.85.161.173; envelope-from=geyslan@gmail.com; helo=mail-gg0-f173.google.com; Received: from mail-gg0-f173.google.com ([209.85.161.173]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1VYLWz-0002qm-U9 for v9fs-developer@lists.sourceforge.net; Mon, 21 Oct 2013 19:52:51 +0000 Received: by mail-gg0-f173.google.com with SMTP id e5so250862ggk.32 for ; Mon, 21 Oct 2013 12:52:44 -0700 (PDT) X-Received: by 10.236.38.74 with SMTP id z50mr31629yha.134.1382385164329; Mon, 21 Oct 2013 12:52:44 -0700 (PDT) Received: from localhost.localdomain (189-48-116-98.user.veloxzone.com.br. [189.48.116.98]) by mx.google.com with ESMTPSA id e39sm29434639yhq.15.2013.10.21.12.52.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Oct 2013 12:52:43 -0700 (PDT) From: "Geyslan G. Bem" To: kernel-br@googlegroups.com Date: Mon, 21 Oct 2013 16:47:58 -0300 Message-Id: <1382384878-12788-1-git-send-email-geyslan@gmail.com> X-Mailer: git-send-email 1.8.4 X-Spam-Score: -1.6 (-) X-Headers-End: 1VYLWz-0002qm-U9 Cc: Latchesar Ionkov , "Geyslan G. Bem" , Eric Van Hensbergen , open list , "open list:9P FILE SYSTEM" , Ron Minnich Subject: [V9fs-developer] [PATCH] 9p: fix return value in case in v9fs_fid_xattr_set() X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error in the p9_client_write, the function v9fs_fid_xattr_set should return its negative value, what was never being done. In case of success it only retuned 0. Now it returns the 'offset' variable (write_count total). Signed-off-by: Geyslan G. Bem --- fs/9p/xattr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c index 3c28cdf..04133a1 100644 --- a/fs/9p/xattr.c +++ b/fs/9p/xattr.c @@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, if (retval < 0) { p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n", retval); - p9_client_clunk(fid); - return retval; + goto err; } msize = fid->clnt->msize; while (value_len) { @@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, if (write_count < 0) { /* error in xattr write */ retval = write_count; - break; + goto err; } offset += write_count; value_len -= write_count; } - return p9_client_clunk(fid); + retval = offset; +err: + p9_client_clunk(fid); + return retval; } ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)