From a6d61b6b2c6268f8ff493e0978cfbbaf2c74655c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 7 Jan 2003 17:48:21 -0800 Subject: [PATCH] [PATCH] return the correct thing from direct-io If direct-io encounters an error, it currently returns that error even if it performed some I/O. Change it so that if there is an error and we read or wrote something, return the number of bytes written/read. Only return the error code if zero bytes were written/read. --- fs/direct-io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index e94615eb837d..643f03c26d55 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -837,10 +837,8 @@ direct_io_worker(int rw, struct inode *inode, const struct iovec *iov, ret = ret2; if (ret == 0) ret = dio.page_errors; - if (ret == 0) - ret = tot_bytes; - return ret; + return tot_bytes ? tot_bytes : ret; } /* -- 2.39.5