Skip to content

Commit 6a81749

Browse files
jtlaytonidryomov
authored andcommitted
ceph: increment/decrement dio counter on async requests
Ceph can in some cases issue an async DIO request, in which case we can end up calling ceph_end_io_direct before the I/O is actually complete. That may allow buffered operations to proceed while DIO requests are still in flight. Fix this by incrementing the i_dio_count when issuing an async DIO request, and decrement it when tearing down the aio_req. Fixes: 321fe13 ("ceph: add buffered/direct exclusionary locking for reads and writes") Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent a81bc31 commit 6a81749

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/ceph/file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,9 @@ static void ceph_aio_complete(struct inode *inode,
753753
if (!atomic_dec_and_test(&aio_req->pending_reqs))
754754
return;
755755

756+
if (aio_req->iocb->ki_flags & IOCB_DIRECT)
757+
inode_dio_end(inode);
758+
756759
ret = aio_req->error;
757760
if (!ret)
758761
ret = aio_req->total_len;
@@ -1091,6 +1094,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
10911094
CEPH_CAP_FILE_RD);
10921095

10931096
list_splice(&aio_req->osd_reqs, &osd_reqs);
1097+
inode_dio_begin(inode);
10941098
while (!list_empty(&osd_reqs)) {
10951099
req = list_first_entry(&osd_reqs,
10961100
struct ceph_osd_request,

0 commit comments

Comments
 (0)