diff mbox series

[2/3] fs: Export generic_fadvise()

Message ID 20190711140012.1671-3-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series xfs: Fix races between readahead and hole punching | expand

Commit Message

Jan Kara July 11, 2019, 2 p.m. UTC
Filesystems will need to call this function from their fadvise handlers.

CC: stable@vger.kernel.org # Needed by "xfs: Fix stale data exposure when
					readahead races with hole punch"
Signed-off-by: Jan Kara <jack@suse.cz>
---
 include/linux/fs.h | 2 ++
 mm/fadvise.c       | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Darrick J. Wong July 12, 2019, 5:50 p.m. UTC | #1
On Thu, Jul 11, 2019 at 04:00:11PM +0200, Jan Kara wrote:
> Filesystems will need to call this function from their fadvise handlers.
> 
> CC: stable@vger.kernel.org # Needed by "xfs: Fix stale data exposure when
> 					readahead races with hole punch"
> Signed-off-by: Jan Kara <jack@suse.cz>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  include/linux/fs.h | 2 ++
>  mm/fadvise.c       | 4 ++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index f7fdfe93e25d..2666862ff00d 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3536,6 +3536,8 @@ extern void inode_nohighmem(struct inode *inode);
>  /* mm/fadvise.c */
>  extern int vfs_fadvise(struct file *file, loff_t offset, loff_t len,
>  		       int advice);
> +extern int generic_fadvise(struct file *file, loff_t offset, loff_t len,
> +			   int advice);
>  
>  #if defined(CONFIG_IO_URING)
>  extern struct sock *io_uring_get_socket(struct file *file);
> diff --git a/mm/fadvise.c b/mm/fadvise.c
> index 467bcd032037..4f17c83db575 100644
> --- a/mm/fadvise.c
> +++ b/mm/fadvise.c
> @@ -27,8 +27,7 @@
>   * deactivate the pages and clear PG_Referenced.
>   */
>  
> -static int generic_fadvise(struct file *file, loff_t offset, loff_t len,
> -			   int advice)
> +int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
>  {
>  	struct inode *inode;
>  	struct address_space *mapping;
> @@ -178,6 +177,7 @@ static int generic_fadvise(struct file *file, loff_t offset, loff_t len,
>  	}
>  	return 0;
>  }
> +EXPORT_SYMBOL(generic_fadvise);
>  
>  int vfs_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
>  {
> -- 
> 2.16.4
>
Sasha Levin July 12, 2019, 11:55 p.m. UTC | #2
Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.2, v5.1.17, v4.19.58, v4.14.133, v4.9.185, v4.4.185.

v5.2: Build OK!
v5.1.17: Build OK!
v4.19.58: Build OK!
v4.14.133: Failed to apply! Possible dependencies:
    17ef445f9bef ("Documentation/filesystems: update documentation of file_operations")
    312db1aa1dc7 ("fs: add ksys_mount() helper; remove in-kernel calls to sys_mount()")
    36028d5dd711 ("fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to syscalls")
    3a18ef5c1b39 ("fs: add ksys_umount() helper; remove in-kernel call to sys_umount()")
    3ce4a7bf6626 ("fs: add ksys_read() helper; remove in-kernel calls to sys_read()")
    45cd0faae371 ("vfs: add the fadvise() file operation")
    6e8b704df584 ("fs: update documentation to mention __poll_t and match the code")
    70f68ee81e2e ("fs: add ksys_sync() helper; remove in-kernel calls to sys_sync()")
    806cbae1228c ("fs: add ksys_sync_file_range helper(); remove in-kernel calls to syscall")
    819671ff849b ("syscalls: define and explain goal to not call syscalls in the kernel")
    9b32105ec6b1 ("kernel: add ksys_unshare() helper; remove in-kernel calls to sys_unshare()")
    9d5b7c956b09 ("mm: add ksys_fadvise64_64() helper; remove in-kernel call to sys_fadvise64_64()")
    a16fe33ab557 ("fs: add ksys_chroot() helper; remove-in kernel calls to sys_chroot()")
    c7248321a3d4 ("fs: add ksys_dup{,3}() helper; remove in-kernel calls to sys_dup{,3}()")
    e2aaa9f42336 ("kernel: add ksys_setsid() helper; remove in-kernel call to sys_setsid()")
    e7a3e8b2edf5 ("fs: add ksys_write() helper; remove in-kernel calls to sys_write()")
    edf292c76b88 ("fs: add ksys_fallocate() wrapper; remove in-kernel calls to sys_fallocate()")

v4.9.185: Failed to apply! Possible dependencies:
    17ef445f9bef ("Documentation/filesystems: update documentation of file_operations")
    3859a271a003 ("randstruct: Mark various structs for randomization")
    45cd0faae371 ("vfs: add the fadvise() file operation")
    5613fda9a503 ("sched/cputime: Convert task/group cputime to nsecs")
    60f3e00d25b4 ("sysv,ipc: cacheline align kern_ipc_perm")
    6e8b704df584 ("fs: update documentation to mention __poll_t and match the code")
    8c8b73c4811f ("sched/cputime, powerpc: Prepare accounting structure for cputime flush on tick")
    a19ff1a2cc92 ("sched/cputime, powerpc/vtime: Accumulate cputime and account only on tick/task switch")
    b18b6a9cef7f ("timers: Omit POSIX timer stuff from task_struct when disabled")
    baa73d9e478f ("posix-timers: Make them configurable")
    c3edc4010e9d ("sched/headers: Move task_struct::signal and task_struct::sighand types and accessors into <linux/sched/signal.h>")
    d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm")
    f828c3d0aeba ("sched/cputime, powerpc: Migrate stolen_time field to the accounting structure")

v4.4.185: Failed to apply! Possible dependencies:
    04b38d601239 ("vfs: pull btrfs clone API to vfs layer")
    17ef445f9bef ("Documentation/filesystems: update documentation of file_operations")
    29732938a628 ("vfs: add copy_file_range syscall and vfs helper")
    3859a271a003 ("randstruct: Mark various structs for randomization")
    3db11b2eecc0 ("btrfs: add .copy_file_range file operation")
    45cd0faae371 ("vfs: add the fadvise() file operation")
    54dbc1517237 ("vfs: hoist the btrfs deduplication ioctl to the vfs")
    6e8b704df584 ("fs: update documentation to mention __poll_t and match the code")
    75ba1d07fd6a ("seq/proc: modify seq_put_decimal_[u]ll to take a const char *, not char")
    81243eacfa40 ("cred: simpler, 1D supplementary groups")
    d79bdd52d8be ("vfs: wire up compat ioctl for CLONE/CLONE_RANGE")
    f7a5f132b447 ("proc: faster /proc/*/status")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

--
Thanks,
Sasha
diff mbox series

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index f7fdfe93e25d..2666862ff00d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3536,6 +3536,8 @@  extern void inode_nohighmem(struct inode *inode);
 /* mm/fadvise.c */
 extern int vfs_fadvise(struct file *file, loff_t offset, loff_t len,
 		       int advice);
+extern int generic_fadvise(struct file *file, loff_t offset, loff_t len,
+			   int advice);
 
 #if defined(CONFIG_IO_URING)
 extern struct sock *io_uring_get_socket(struct file *file);
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 467bcd032037..4f17c83db575 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -27,8 +27,7 @@ 
  * deactivate the pages and clear PG_Referenced.
  */
 
-static int generic_fadvise(struct file *file, loff_t offset, loff_t len,
-			   int advice)
+int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
 {
 	struct inode *inode;
 	struct address_space *mapping;
@@ -178,6 +177,7 @@  static int generic_fadvise(struct file *file, loff_t offset, loff_t len,
 	}
 	return 0;
 }
+EXPORT_SYMBOL(generic_fadvise);
 
 int vfs_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
 {