Skip to content

Commit 8c3cfa8

Browse files
amir73ilbrauner
authored andcommitted
aio: use kiocb_{start,end}_write() helpers
Use helpers instead of the open coded dance to silence lockdep warnings. Suggested-by: Jan Kara <[email protected]> Signed-off-by: Amir Goldstein <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent e484fd7 commit 8c3cfa8

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

fs/aio.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,13 +1447,8 @@ static void aio_complete_rw(struct kiocb *kiocb, long res)
14471447
if (kiocb->ki_flags & IOCB_WRITE) {
14481448
struct inode *inode = file_inode(kiocb->ki_filp);
14491449

1450-
/*
1451-
* Tell lockdep we inherited freeze protection from submission
1452-
* thread.
1453-
*/
14541450
if (S_ISREG(inode->i_mode))
1455-
__sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE);
1456-
file_end_write(kiocb->ki_filp);
1451+
kiocb_end_write(kiocb);
14571452
}
14581453

14591454
iocb->ki_res.res = res;
@@ -1581,17 +1576,8 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb,
15811576
return ret;
15821577
ret = rw_verify_area(WRITE, file, &req->ki_pos, iov_iter_count(&iter));
15831578
if (!ret) {
1584-
/*
1585-
* Open-code file_start_write here to grab freeze protection,
1586-
* which will be released by another thread in
1587-
* aio_complete_rw(). Fool lockdep by telling it the lock got
1588-
* released so that it doesn't complain about the held lock when
1589-
* we return to userspace.
1590-
*/
1591-
if (S_ISREG(file_inode(file)->i_mode)) {
1592-
sb_start_write(file_inode(file)->i_sb);
1593-
__sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE);
1594-
}
1579+
if (S_ISREG(file_inode(file)->i_mode))
1580+
kiocb_start_write(req);
15951581
req->ki_flags |= IOCB_WRITE;
15961582
aio_rw_done(req, call_write_iter(file, req, &iter));
15971583
}

0 commit comments

Comments
 (0)