[PATCH 2/5] direct-io: fix dio_complete() errno passing in sync completion path

From: Tejun Heo
Date: Wed Nov 08 2006 - 20:16:58 EST


In synchronous completion path, the number of transferred bytes is
always passed to dio_complete() as @bytes argument whether the
transfer succeeded or not. Fix it.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
---
fs/direct-io.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 25721b2..c85aee3 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1138,10 +1138,11 @@ direct_io_worker(int rw, struct kiocb *i
if (rw == READ && (offset + transferred > i_size))
transferred = i_size - offset;
}
- dio_complete(dio, offset, transferred);
if (ret == 0)
ret = transferred;

+ dio_complete(dio, offset, ret);
+
/* We could have also come here on an AIO file extend */
if (!is_sync_kiocb(iocb) && (rw & WRITE) &&
ret >= 0 && dio->result == dio->size)
--
1.4.3.3


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/