All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2_direct_IO_write misses ocfs2_is_overwrite error code
@ 2015-09-07  2:11 Norton.Zhu
  2015-09-11 21:20 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Norton.Zhu @ 2015-09-07  2:11 UTC (permalink / raw)
  To: ocfs2-devel

If ocfs2_is_overwrite failed, ocfs2_direct_IO_write mays till return success to the caller.

Signed-off-by: Norton.Zhu <norton.zhu@huawei.com>
---
 aops.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/aops.c b/aops.c
index 0f5fd9d..4107279 100644
--- a/aops.c
+++ b/aops.c
@@ -847,6 +847,7 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb,
 		is_overwrite = ocfs2_is_overwrite(osb, inode, offset);
 		if (is_overwrite < 0) {
 			mlog_errno(is_overwrite);
+			ret = is_overwrite;
 			ocfs2_inode_unlock(inode, 1);
 			goto clean_orphan;
 		}
-- 
1.8.4.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Ocfs2-devel] [PATCH] ocfs2_direct_IO_write misses ocfs2_is_overwrite error code
  2015-09-07  2:11 [Ocfs2-devel] [PATCH] ocfs2_direct_IO_write misses ocfs2_is_overwrite error code Norton.Zhu
@ 2015-09-11 21:20 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2015-09-11 21:20 UTC (permalink / raw)
  To: ocfs2-devel

On Mon, 7 Sep 2015 10:11:56 +0800 "Norton.Zhu" <norton.zhu@huawei.com> wrote:

> If ocfs2_is_overwrite failed, ocfs2_direct_IO_write mays till return success to the caller.
> 
> ...
>
> --- a/aops.c
> +++ b/aops.c
> @@ -847,6 +847,7 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb,
>  		is_overwrite = ocfs2_is_overwrite(osb, inode, offset);
>  		if (is_overwrite < 0) {
>  			mlog_errno(is_overwrite);
> +			ret = is_overwrite;
>  			ocfs2_inode_unlock(inode, 1);
>  			goto clean_orphan;
>  		}

Looks OK.

We do `goto clean_orphan' and if (orphan), the code then proceeds to
overwrite the error code in `ret'.  This is odd, and probably wrong -
it's usually best to return the first-encountered error.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-11 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-07  2:11 [Ocfs2-devel] [PATCH] ocfs2_direct_IO_write misses ocfs2_is_overwrite error code Norton.Zhu
2015-09-11 21:20 ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.