From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755662AbbB0Xv1 (ORCPT ); Fri, 27 Feb 2015 18:51:27 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33178 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755415AbbB0XvY (ORCPT ); Fri, 27 Feb 2015 18:51:24 -0500 Date: Sat, 28 Feb 2015 08:48:40 +0900 From: Daeseok Youn To: mfasheh@suse.com, akpm@linux-foundation.org Cc: jlbec@evilplan.org, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, richard.weinberger@gmail.com Subject: [PATCH 1/4 V2] ocfs2: use retval instead of status for checking error Message-ID: <20150227234840.GA12922@devel.8.8.4.4> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The use of 'status' in __ocfs2_add_entry() can return wrong status when some functions are failed. If ocfs2_journal_access_db() in __ocfs2_add_entry() is failed, that status is saved to 'status' but return variable is 'retval' which is saved 'success' status. In case of this, __ocfs2_add_entry() is failed but can be returned as 'success'. So replace 'status' with 'retval'. Signed-off-by: Daeseok Youn --- V2 : update changelog fs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index b08050b..1478a50 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1617,7 +1617,7 @@ int __ocfs2_add_entry(handle_t *handle, struct ocfs2_dir_entry *de, *de1; struct ocfs2_dinode *di = (struct ocfs2_dinode *)parent_fe_bh->b_data; struct super_block *sb = dir->i_sb; - int retval, status; + int retval; unsigned int size = sb->s_blocksize; struct buffer_head *insert_bh = lookup->dl_leaf_bh; char *data_start = insert_bh->b_data; @@ -1695,22 +1695,22 @@ int __ocfs2_add_entry(handle_t *handle, } if (insert_bh == parent_fe_bh) - status = ocfs2_journal_access_di(handle, + retval = ocfs2_journal_access_di(handle, INODE_CACHE(dir), insert_bh, OCFS2_JOURNAL_ACCESS_WRITE); else { - status = ocfs2_journal_access_db(handle, + retval = ocfs2_journal_access_db(handle, INODE_CACHE(dir), insert_bh, OCFS2_JOURNAL_ACCESS_WRITE); if (ocfs2_dir_indexed(dir)) { - status = ocfs2_dx_dir_insert(dir, + retval = ocfs2_dx_dir_insert(dir, handle, lookup); - if (status) { - mlog_errno(status); + if (retval) { + mlog_errno(retval); goto bail; } } -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daeseok Youn Date: Sat, 28 Feb 2015 08:48:40 +0900 Subject: [Ocfs2-devel] [PATCH 1/4 V2] ocfs2: use retval instead of status for checking error Message-ID: <20150227234840.GA12922@devel.8.8.4.4> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: mfasheh@suse.com, akpm@linux-foundation.org Cc: jlbec@evilplan.org, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, richard.weinberger@gmail.com The use of 'status' in __ocfs2_add_entry() can return wrong status when some functions are failed. If ocfs2_journal_access_db() in __ocfs2_add_entry() is failed, that status is saved to 'status' but return variable is 'retval' which is saved 'success' status. In case of this, __ocfs2_add_entry() is failed but can be returned as 'success'. So replace 'status' with 'retval'. Signed-off-by: Daeseok Youn --- V2 : update changelog fs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index b08050b..1478a50 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1617,7 +1617,7 @@ int __ocfs2_add_entry(handle_t *handle, struct ocfs2_dir_entry *de, *de1; struct ocfs2_dinode *di = (struct ocfs2_dinode *)parent_fe_bh->b_data; struct super_block *sb = dir->i_sb; - int retval, status; + int retval; unsigned int size = sb->s_blocksize; struct buffer_head *insert_bh = lookup->dl_leaf_bh; char *data_start = insert_bh->b_data; @@ -1695,22 +1695,22 @@ int __ocfs2_add_entry(handle_t *handle, } if (insert_bh == parent_fe_bh) - status = ocfs2_journal_access_di(handle, + retval = ocfs2_journal_access_di(handle, INODE_CACHE(dir), insert_bh, OCFS2_JOURNAL_ACCESS_WRITE); else { - status = ocfs2_journal_access_db(handle, + retval = ocfs2_journal_access_db(handle, INODE_CACHE(dir), insert_bh, OCFS2_JOURNAL_ACCESS_WRITE); if (ocfs2_dir_indexed(dir)) { - status = ocfs2_dx_dir_insert(dir, + retval = ocfs2_dx_dir_insert(dir, handle, lookup); - if (status) { - mlog_errno(status); + if (retval) { + mlog_errno(retval); goto bail; } } -- 1.7.1