hulk inclusion category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/13283 ------------------ The .map_pages holds the rcu_read_lock() before calling specifical .map_pages helpers. And in MFS's remote mode, the .map_pages will trigger sync events and call schedule() after sending the messages. This may cause potential deadlock risk and the rcu detector also reports the warning. The .map_pages tries to reduce the minor page fault overhead, that means the data is already in page cache. And we also can prefetch the data in strategy when the major fault is happened. So the MFS_OP_FAROUND event can be removed. Fixes: bfa1ad801c5d ("mfs: Add basic cache framework: check method and control structure") Signed-off-by: Hongbo Li <lihongbo22@huawei.com> --- Documentation/filesystems/mfs.rst | 4 +--- fs/mfs/data.c | 22 ---------------------- include/uapi/linux/mfs.h | 1 - 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/Documentation/filesystems/mfs.rst b/Documentation/filesystems/mfs.rst index a291fbf48cf1..b81ba1fea818 100644 --- a/Documentation/filesystems/mfs.rst +++ b/Documentation/filesystems/mfs.rst @@ -110,11 +110,9 @@ Currently the opcode is defined as follows:: enum mfs_opcode { MFS_OP_READ = 0, MFS_OP_FAULT, - MFS_OP_FAROUND, }; -where means: normal read event, page fault event and the fault around event -before ongoing fault. +where means: normal read event and page fault event. Running mode ============ diff --git a/fs/mfs/data.c b/fs/mfs/data.c index 32d0b6947aa8..c4d429b6644d 100644 --- a/fs/mfs/data.c +++ b/fs/mfs/data.c @@ -430,12 +430,9 @@ static vm_fault_t mfs_filemap_map_pages(struct vm_fault *vmf, { struct file *cfile, *file = vmf->vma->vm_file; struct mfs_file_info *fi = file->private_data; - size_t isize = i_size_read(file_inode(file)); const struct vm_operations_struct *cvm_ops; struct vm_area_struct cvma, *vma, **vma_; - struct range_ctx ctx; vm_fault_t ret; - int err; vma = vmf->vma; memcpy(&cvma, vma, sizeof(struct vm_area_struct)); @@ -445,27 +442,8 @@ static vm_fault_t mfs_filemap_map_pages(struct vm_fault *vmf, if (unlikely(!cvm_ops->map_pages)) return 0; - if ((start_pgoff << PAGE_SHIFT) >= isize) - return 0; (void)get_file(cfile); - ctx.file = cfile; - ctx.object = file_inode(file)->i_private; - ctx.off = start_pgoff << PAGE_SHIFT; - ctx.len = min_t(size_t, isize - ctx.off, (end_pgoff - start_pgoff) << PAGE_SHIFT); - ctx.op = MFS_OP_FAROUND; - ctx.sync = false; - ctx.checker = range_check_mem; - if (need_sync_event(file_inode(file)->i_sb)) { - ctx.sync = true; - ctx.checker = range_check_disk; - } - err = mfs_check_range(&ctx); - if (err) { - fput(cfile); - return 0; - } - vma_ = (struct vm_area_struct **)&vmf->vma; *vma_ = &cvma; ret = cvm_ops->map_pages(vmf, start_pgoff, end_pgoff); diff --git a/include/uapi/linux/mfs.h b/include/uapi/linux/mfs.h index a7d5882b5e50..8a79a4e061fa 100644 --- a/include/uapi/linux/mfs.h +++ b/include/uapi/linux/mfs.h @@ -9,7 +9,6 @@ enum mfs_opcode { MFS_OP_READ = 0, MFS_OP_FAULT, - MFS_OP_FAROUND, }; enum { -- 2.34.1