Skip to contentSkip to conversation

ocfs2_direct_IO_write misses ocfs2_is_overwrite error code

PATCH Superseded Norton.Zhu 2 participants 2 messages Sep 7, 2015 – Sep 11, 2015 OCFS2

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Norton.Zhu

author
#0 lore raw

PATCH 1/1 ocfs2_direct_IO_write misses ocfs2_is_overwrite error code

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

---
 aops.c | 1 +
 1 file changed, 1 insertion(+)
aops.c +1 -0
index 0f5fd9d..4107279 100644
@@ -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;
 		}
Signature · 1 line
1.8.4.3
#1 lore raw

PATCH 1/1 ocfs2_direct_IO_write misses ocfs2_is_overwrite error code

Quoted 7 lines · On Mon, 7 Sep 2015 10:11:56 +0800 "Norton.Zhu" <[email protected]> wrote:

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

...

aops.c static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb, · line 853

Quoted 7 lines
aops.c +1 -0
@@ -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.