Message ID | 20230817141337.1025891-7-amir73il@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kiocb_{start,end}_write() helpers | expand |
On Thu 17-08-23 17:13:36, Amir Goldstein wrote: > 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> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/overlayfs/file.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c > index 21245b00722a..e4cc401d334d 100644 > --- a/fs/overlayfs/file.c > +++ b/fs/overlayfs/file.c > @@ -290,10 +290,7 @@ static void ovl_aio_cleanup_handler(struct ovl_aio_req *aio_req) > if (iocb->ki_flags & IOCB_WRITE) { > struct inode *inode = file_inode(orig_iocb->ki_filp); > > - /* Actually acquired in ovl_write_iter() */ > - __sb_writers_acquired(file_inode(iocb->ki_filp)->i_sb, > - SB_FREEZE_WRITE); > - file_end_write(iocb->ki_filp); > + kiocb_end_write(iocb); > ovl_copyattr(inode); > } > > @@ -409,10 +406,6 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) > if (!aio_req) > goto out; > > - file_start_write(real.file); > - /* Pacify lockdep, same trick as done in aio_write() */ > - __sb_writers_release(file_inode(real.file)->i_sb, > - SB_FREEZE_WRITE); > aio_req->fd = real; > real.flags = 0; > aio_req->orig_iocb = iocb; > @@ -420,6 +413,7 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) > aio_req->iocb.ki_flags = ifl; > aio_req->iocb.ki_complete = ovl_aio_rw_complete; > refcount_set(&aio_req->ref, 2); > + kiocb_start_write(&aio_req->iocb); > ret = vfs_iocb_iter_write(real.file, &aio_req->iocb, iter); > ovl_aio_put(aio_req); > if (ret != -EIOCBQUEUED) > -- > 2.34.1 >
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 21245b00722a..e4cc401d334d 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -290,10 +290,7 @@ static void ovl_aio_cleanup_handler(struct ovl_aio_req *aio_req) if (iocb->ki_flags & IOCB_WRITE) { struct inode *inode = file_inode(orig_iocb->ki_filp); - /* Actually acquired in ovl_write_iter() */ - __sb_writers_acquired(file_inode(iocb->ki_filp)->i_sb, - SB_FREEZE_WRITE); - file_end_write(iocb->ki_filp); + kiocb_end_write(iocb); ovl_copyattr(inode); } @@ -409,10 +406,6 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) if (!aio_req) goto out; - file_start_write(real.file); - /* Pacify lockdep, same trick as done in aio_write() */ - __sb_writers_release(file_inode(real.file)->i_sb, - SB_FREEZE_WRITE); aio_req->fd = real; real.flags = 0; aio_req->orig_iocb = iocb; @@ -420,6 +413,7 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) aio_req->iocb.ki_flags = ifl; aio_req->iocb.ki_complete = ovl_aio_rw_complete; refcount_set(&aio_req->ref, 2); + kiocb_start_write(&aio_req->iocb); ret = vfs_iocb_iter_write(real.file, &aio_req->iocb, iter); ovl_aio_put(aio_req); if (ret != -EIOCBQUEUED)
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> --- fs/overlayfs/file.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)