lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250903180624.218013-1-lorenzo.stoakes@oracle.com>
Date: Wed,  3 Sep 2025 19:06:24 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Christian Brauner <christian@...uner.io>
Cc: Andreas Gruenbacher <agruenba@...hat.com>, Jan Kara <jack@...e.com>,
        gfs2@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH v2] gfs2, udf: update to use mmap_prepare

The f_op->mmap() callback is deprecated, and we are in the process of
slowly converting users to f_op->mmap_prepare().

While some filesystems require additional work to be done before they can
be converted, the gfs2 and udf filesystems (like most) are simple and can
simply be replaced right away.

This patch does so.

Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Reviewed-by: Jan Kara <jack@...e.cz>
---
v2:
* Fix typo in referenceing gfs2_mmap_prepare.
* Fix gfs2_mmap_prepare() kerneldoc.
* Very minor fixup in commit message.

v1:
https://lore.kernel.org/all/20250902115341.292100-1-lorenzo.stoakes@oracle.com/

 fs/gfs2/file.c | 15 +++++++--------
 fs/udf/file.c  |  8 +++++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index bc67fa058c84..b1c3482c65e3 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -577,9 +577,8 @@ static const struct vm_operations_struct gfs2_vm_ops = {
 };

 /**
- * gfs2_mmap
- * @file: The file to map
- * @vma: The VMA which described the mapping
+ * gfs2_mmap_prepare
+ * @desc: A description of the VMA being mapped
  *
  * There is no need to get a lock here unless we should be updating
  * atime. We ignore any locking errors since the only consequence is
@@ -588,8 +587,9 @@ static const struct vm_operations_struct gfs2_vm_ops = {
  * Returns: 0
  */

-static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
+static int gfs2_mmap_prepare(struct vm_area_desc *desc)
 {
+	struct file *file = desc->file;
 	struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);

 	if (!(file->f_flags & O_NOATIME) &&
@@ -605,7 +605,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
 		gfs2_glock_dq_uninit(&i_gh);
 		file_accessed(file);
 	}
-	vma->vm_ops = &gfs2_vm_ops;
+	desc->vm_ops = &gfs2_vm_ops;

 	return 0;
 }
@@ -1585,7 +1585,7 @@ const struct file_operations gfs2_file_fops = {
 	.iopoll		= iocb_bio_iopoll,
 	.unlocked_ioctl	= gfs2_ioctl,
 	.compat_ioctl	= gfs2_compat_ioctl,
-	.mmap		= gfs2_mmap,
+	.mmap_prepare	= gfs2_mmap_prepare,
 	.open		= gfs2_open,
 	.release	= gfs2_release,
 	.fsync		= gfs2_fsync,
@@ -1620,7 +1620,7 @@ const struct file_operations gfs2_file_fops_nolock = {
 	.iopoll		= iocb_bio_iopoll,
 	.unlocked_ioctl	= gfs2_ioctl,
 	.compat_ioctl	= gfs2_compat_ioctl,
-	.mmap		= gfs2_mmap,
+	.mmap_prepare	= gfs2_mmap_prepare,
 	.open		= gfs2_open,
 	.release	= gfs2_release,
 	.fsync		= gfs2_fsync,
@@ -1639,4 +1639,3 @@ const struct file_operations gfs2_dir_fops_nolock = {
 	.fsync		= gfs2_fsync,
 	.llseek		= default_llseek,
 };
-
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 0d76c4f37b3e..fbb2d6ba8ca2 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -189,10 +189,12 @@ static int udf_release_file(struct inode *inode, struct file *filp)
 	return 0;
 }

-static int udf_file_mmap(struct file *file, struct vm_area_struct *vma)
+static int udf_file_mmap_prepare(struct vm_area_desc *desc)
 {
+	struct file *file = desc->file;
+
 	file_accessed(file);
-	vma->vm_ops = &udf_file_vm_ops;
+	desc->vm_ops = &udf_file_vm_ops;

 	return 0;
 }
@@ -201,7 +203,7 @@ const struct file_operations udf_file_operations = {
 	.read_iter		= generic_file_read_iter,
 	.unlocked_ioctl		= udf_ioctl,
 	.open			= generic_file_open,
-	.mmap			= udf_file_mmap,
+	.mmap_prepare		= udf_file_mmap_prepare,
 	.write_iter		= udf_file_write_iter,
 	.release		= udf_release_file,
 	.fsync			= generic_file_fsync,
--
2.50.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ