[Ocfs2-devel] [PATCH] ocfs2_direct_IO_write misses ocfs2_is_overwrite error code

Andrew Morton akpm at linux-foundation.org
Fri Sep 11 14:20:25 PDT 2015


On Mon, 7 Sep 2015 10:11:56 +0800 "Norton.Zhu" <norton.zhu at 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.





More information about the Ocfs2-devel mailing list