mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
aio: use kiocb_{start,end}_write() helpers
Use helpers instead of the open coded dance to silence lockdep warnings. Suggested-by: Jan Kara <jack@suse.cz> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Jens Axboe <axboe@kernel.dk> Message-Id: <20230817141337.1025891-6-amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
e484fd73f4
commit
8c3cfa80fd
1 changed files with 3 additions and 17 deletions
20
fs/aio.c
20
fs/aio.c
|
@ -1447,13 +1447,8 @@ static void aio_complete_rw(struct kiocb *kiocb, long res)
|
||||||
if (kiocb->ki_flags & IOCB_WRITE) {
|
if (kiocb->ki_flags & IOCB_WRITE) {
|
||||||
struct inode *inode = file_inode(kiocb->ki_filp);
|
struct inode *inode = file_inode(kiocb->ki_filp);
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell lockdep we inherited freeze protection from submission
|
|
||||||
* thread.
|
|
||||||
*/
|
|
||||||
if (S_ISREG(inode->i_mode))
|
if (S_ISREG(inode->i_mode))
|
||||||
__sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE);
|
kiocb_end_write(kiocb);
|
||||||
file_end_write(kiocb->ki_filp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iocb->ki_res.res = res;
|
iocb->ki_res.res = res;
|
||||||
|
@ -1581,17 +1576,8 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb,
|
||||||
return ret;
|
return ret;
|
||||||
ret = rw_verify_area(WRITE, file, &req->ki_pos, iov_iter_count(&iter));
|
ret = rw_verify_area(WRITE, file, &req->ki_pos, iov_iter_count(&iter));
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
/*
|
if (S_ISREG(file_inode(file)->i_mode))
|
||||||
* Open-code file_start_write here to grab freeze protection,
|
kiocb_start_write(req);
|
||||||
* which will be released by another thread in
|
|
||||||
* aio_complete_rw(). Fool lockdep by telling it the lock got
|
|
||||||
* released so that it doesn't complain about the held lock when
|
|
||||||
* we return to userspace.
|
|
||||||
*/
|
|
||||||
if (S_ISREG(file_inode(file)->i_mode)) {
|
|
||||||
sb_start_write(file_inode(file)->i_sb);
|
|
||||||
__sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE);
|
|
||||||
}
|
|
||||||
req->ki_flags |= IOCB_WRITE;
|
req->ki_flags |= IOCB_WRITE;
|
||||||
aio_rw_done(req, call_write_iter(file, req, &iter));
|
aio_rw_done(req, call_write_iter(file, req, &iter));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue