ANDROID: fuse-bpf: remove file write lock to prevent recursive lock

The functions vfs_iter_write and vfs_iocb_iter_write already perform
write locking. Therefore, we do not need to additionally control the
file write lock, expect for async iocb.

Bug: 399505736
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
Change-Id: I5fe90b0fcaf06f4609ec704bc5a727a413f89625
This commit is contained in:
Ed Tsai
2025-02-27 12:05:48 +08:00
committed by Paul Lawrence
parent 78244fd3ba
commit 54a7d45d7c
+1 -7
View File
@@ -780,9 +780,7 @@ static void fuse_bpf_aio_cleanup_handler(struct fuse_bpf_aio_req *aio_req)
struct kiocb *iocb_orig = aio_req->iocb_orig;
if (iocb->ki_flags & IOCB_WRITE) {
__sb_writers_acquired(file_inode(iocb->ki_filp)->i_sb,
SB_FREEZE_WRITE);
file_end_write(iocb->ki_filp);
kiocb_end_write(iocb);
fuse_copyattr(iocb_orig->ki_filp, iocb->ki_filp);
}
iocb_orig->ki_pos = iocb->ki_pos;
@@ -945,10 +943,8 @@ int fuse_file_write_iter_backing(struct fuse_bpf_args *fa,
fuse_copyattr(file, ff->backing_file);
if (is_sync_kiocb(iocb)) {
file_start_write(ff->backing_file);
ret = vfs_iter_write(ff->backing_file, from, &iocb->ki_pos,
iocb->ki_flags & FUSE_BPF_IOCB_MASK);
file_end_write(ff->backing_file);
/* Must reflect change in size of backing file to upper file */
if (ret > 0)
@@ -961,8 +957,6 @@ int fuse_file_write_iter_backing(struct fuse_bpf_args *fa,
if (!aio_req)
goto out;
file_start_write(ff->backing_file);
__sb_writers_release(file_inode(ff->backing_file)->i_sb, SB_FREEZE_WRITE);
aio_req->iocb_orig = iocb;
kiocb_clone(&aio_req->iocb, iocb, ff->backing_file);
aio_req->iocb.ki_complete = fuse_bpf_aio_rw_complete;