ocfs2: use retval instead of status for checking error
PATCH v2 1/4 ocfs2: use retval instead of status for checking error
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'.
---
V2 : update changelog
fs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
fs/ocfs2/dir.c +6 -6
@@ -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; } }
Signature · 1 line
1.7.1
Am 28.02.2015 um 00:48 schrieb Daeseok Youn:
Quoted 9 lines
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'.
As this patch is untested and the issue is theoretical I'm nervous. But the final decision is up to ocfs2 maintainers.
Thanks,
//richard
Hi, all
please, review this patch.
thanks.
regards,
Daeseok Youn.
2015-03-02 18:04 GMT+09:00 Richard Weinberger <[email protected]>:
Quoted 16 lines
Am 28.02.2015 um 00:48 schrieb Daeseok Youn:
Quoted 9 lines
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'.
As this patch is untested and the issue is theoretical I'm nervous. But the final decision is up to ocfs2 maintainers.
Thanks,
//richard
Hi,
How is this patch going on?
please check for me.
Thanks.
Daeseok Youn.
2015-03-03 10:38 GMT+09:00 DaeSeok Youn <[email protected]>:
Quoted 26 lines
Hi, all
please, review this patch.
thanks.
regards,
Daeseok Youn.2015-03-02 18:04 GMT+09:00 Richard Weinberger <[email protected]>:
Quoted 16 lines
Am 28.02.2015 um 00:48 schrieb Daeseok Youn:
Quoted 9 lines
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'.
As this patch is untested and the issue is theoretical I'm nervous. But the final decision is up to ocfs2 maintainers.
Thanks,
//richard
Hi,
This patch have been pending for 2 weeks.
Do I need to check other things?
please, check for me.
Thanks!
regards,
Daeseok Youn
2015-02-28 8:48 GMT+09:00 Daeseok Youn <[email protected]>:
Quoted 61 lines
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 <[email protected]>---
V2 : update changelogfs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)fs/ocfs2/dir.c +6
-7@@ -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
Am 13.03.2015 um 04:59 schrieb DaeSeok Youn:
Quoted 6 lines
Hi,
This patch have been pending for 2 weeks.
Do I need to check other things?please, check for me.
I cannot speak for OCFS2 folks. But maybe you can give them a better feeling if you proof that your patch is tested.
Thanks,
//richard
Quoted 67 lines
Thanks!
regards,
Daeseok Youn2015-02-28 8:48 GMT+09:00 Daeseok Youn <[email protected]>:
Quoted 61 lines
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 <[email protected]>---
V2 : update changelogfs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)fs/ocfs2/dir.c +6
-7@@ -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
PATCH v2 1/4 ocfs2: use retval instead of status for checking error
Hi, Richard.
Thanks for reply.
Ok. I will keep trying to set the environment for verifying my paches. But, before I said, it takes some time... Setting this filesystem in my machine with qemu is too hard for me. :(
Regards,
Daeseok Youn.
2015. 3. 13. ?? 5:16? "Richard Weinberger" <[email protected]>?? ??:
Quoted 38 lines
Am 13.03.2015 um 04:59 schrieb DaeSeok Youn:
Quoted 6 lines
Hi,
This patch have been pending for 2 weeks.
Do I need to check other things?please, check for me.
I cannot speak for OCFS2 folks. But maybe you can give them a better feeling if you proof that your patch is tested.
Thanks,
//richardQuoted 23 lines
Thanks!
regards,
Daeseok Youn2015-02-28 8:48 GMT+09:00 Daeseok Youn <[email protected]>:
Quoted 17 lines
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 <[email protected]>---
V2 : update changelogfs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
Quoted 7 lines
Quoted 7 lines
fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1618
Quoted 7 lines
fs/ocfs2/dir.c +0
-0@@ -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;
Quoted 11 lines
Quoted 11 lines
fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1698
Quoted 11 lines
fs/ocfs2/dir.c +1
-2struct 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,
Quoted 1 line
Quoted 1 line
fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1698
Quoted 1 line
fs/ocfs2/dir.c +1
-0+ retval =
ocfs2_journal_access_di(handle,
Quoted 1 line
Quoted 1 line
Quoted 1 line
INODE_CACHE(dir),
Quoted 1 line
Quoted 1 line
Quoted 1 line
insert_bh,
Quoted 1 line
Quoted 1 line
Quoted 1 line
OCFS2_JOURNAL_ACCESS_WRITE);
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
else {- status =
ocfs2_journal_access_db(handle,
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ retval =
ocfs2_journal_access_db(handle,
Quoted 1 line
Quoted 1 line
Quoted 1 line
INODE_CACHE(dir),
Quoted 1 line
Quoted 1 line
Quoted 1 line
insert_bh,
Quoted 1 line
Quoted 1 line
Quoted 1 line
OCFS2_JOURNAL_ACCESS_WRITE);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
if (ocfs2_dir_indexed(dir)) {- status =
ocfs2_dx_dir_insert(dir,
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ retval =
ocfs2_dx_dir_insert(dir,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
handle,
lookup);
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
fs/ocfs2/dir.c +2
-3-if (status) { -mlog_errno (status); +if (retval) { +mlog_errno (retval); goto bail; } } --1.7.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20150313/7c2e5ba8/attachment.html
Looks good to me.
Quoted 11 lines · Daeseok Youn
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 <[email protected]>
Quoted 48 lines
---
V2 : update changelogfs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)fs/ocfs2/dir.c +6
-6@@ -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; } }
2015-03-19 15:24 GMT+09:00 Joseph Qi <[email protected]>:
Quoted 11 lines
Looks good to me.
Quoted 8 lines · Daeseok Youn
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'.
Quoted 5 lines
Quoted 3 lines
So replace 'status' with 'retval'.
Signed-off-by Daeseok Youn <[email protected]>Reviewed-by Joseph Qi <[email protected]>
Hi, Joseph.
Thanks for review this patch. I have actually tried to set this file system on my machine with qemu but I didn't success, yet.
Regards,
Daeseok Youn.
Quoted 50 lines
Quoted 48 lines
---
V2 : update changelogfs/ocfs2/dir.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)fs/ocfs2/dir.c +6
-6@@ -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; } }
Quoted 10 lines · On Sat, 28 Feb 2015 08:48:40 +0900 Daeseok Youn <[email protected]> wrote:
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'.
fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1714
Quoted 4 lines
fs/ocfs2/dir.c +2
-1-mlog_errno (status); +if (retval) { +mlog_errno (retval); goto bail;
and
bail:
if (retval) mlog_errno(retval); return retval; }
so we'll clearly log the same error twice.
Hi Andrew,
Quoted 19 lines · Andrew Morton
Quoted 10 lines · On Sat, 28 Feb 2015 08:48:40 +0900 Daeseok Youn <[email protected]> wrote:
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'.
fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1714
Quoted 4 lines
fs/ocfs2/dir.c +2
-1-mlog_errno (status); +if (retval) { +mlog_errno (retval); goto bail;and
Quoted 9 lines
bail:
if (retval) mlog_errno(retval); return retval; }so we'll clearly log the same error twice.
IMO, if we only depends on the bail error log, we still don't know where the error occurs.
So if we want to do the cleanup, the bail error log should be cleaned.
Quoted 6 lines
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel
Hi, Andrew.
2015-03-20 10:17 GMT+09:00 Joseph Qi <[email protected]>:
Quoted 30 lines
Hi Andrew,
Quoted 27 lines · Andrew Morton
Quoted 10 lines · On Sat, 28 Feb 2015 08:48:40 +0900 Daeseok Youn <[email protected]> wrote:
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'.
fs/ocfs2/dir.c int __ocfs2_add_entry(handle_t *handle, · line 1714
Quoted 4 lines
fs/ocfs2/dir.c +2
-1-mlog_errno (status); +if (retval) { +mlog_errno (retval); goto bail;and
bail:
if (retval) mlog_errno(retval); return retval; }so we'll clearly log the same error twice.
As joseph comment, it doesn't need to cleanup mlog_errno() call in this patch. And he reviewed this patch.
Check, please.
Thanks.
Daeseok Youn
Quoted 13 lines
Quoted 1 line
IMO, if we only depends on the bail error log, we still don't know where the error occurs.
So if we want to do the cleanup, the bail error log should be cleaned.Quoted 6 lines
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel