Commit a6d61b6b authored by Andrew Morton's avatar Andrew Morton Committed by Trond Myklebust

[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.
parent 90c4bb05
...@@ -837,10 +837,8 @@ direct_io_worker(int rw, struct inode *inode, const struct iovec *iov, ...@@ -837,10 +837,8 @@ direct_io_worker(int rw, struct inode *inode, const struct iovec *iov,
ret = ret2; ret = ret2;
if (ret == 0) if (ret == 0)
ret = dio.page_errors; ret = dio.page_errors;
if (ret == 0)
ret = tot_bytes;
return ret; return tot_bytes ? tot_bytes : ret;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment