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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230726102603.155522-6-hao.xu@linux.dev>
Date:   Wed, 26 Jul 2023 18:26:01 +0800
From:   Hao Xu <hao.xu@...ux.dev>
To:     io-uring@...r.kernel.org, Jens Axboe <axboe@...nel.dk>
Cc:     Dominique Martinet <asmadeus@...ewreck.org>,
        Pavel Begunkov <asml.silence@...il.com>,
        Christian Brauner <brauner@...nel.org>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Stefan Roesch <shr@...com>, Clay Harris <bugs@...ycon.org>,
        Dave Chinner <david@...morbit.com>,
        "Darrick J . Wong" <djwong@...nel.org>,
        linux-fsdevel@...r.kernel.org, linux-xfs@...r.kernel.org,
        linux-ext4@...r.kernel.org, Wanpeng Li <wanpengli@...cent.com>
Subject: [PATCH 5/7] add llseek_nowait support for xfs

From: Hao Xu <howeyxu@...cent.com>

Add llseek_nowait() operation for xfs, it acts just like llseek(). The
thing different is it delivers nowait parameter to iomap layer.

Signed-off-by: Hao Xu <howeyxu@...cent.com>
---
 fs/xfs/xfs_file.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 73adc0aee2ff..cba82264221d 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1257,10 +1257,11 @@ xfs_file_readdir(
 }
 
 STATIC loff_t
-xfs_file_llseek(
+__xfs_file_llseek(
 	struct file	*file,
 	loff_t		offset,
-	int		whence)
+	int		whence,
+	bool		nowait)
 {
 	struct inode		*inode = file->f_mapping->host;
 
@@ -1282,6 +1283,28 @@ xfs_file_llseek(
 	return vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
 }
 
+STATIC loff_t
+xfs_file_llseek(
+	struct file	*file,
+	loff_t		offset,
+	int		whence)
+{
+	return __xfs_file_llseek(file, offset, whence, false);
+}
+
+STATIC loff_t
+xfs_file_llseek_nowait(
+	struct file	*file,
+	loff_t		offset,
+	int		whence,
+	bool		nowait)
+{
+	if (file->f_op == &xfs_file_operations)
+		return __xfs_file_llseek(file, offset, whence, nowait);
+	else
+		return generic_file_llseek(file, offset, whence);
+}
+
 #ifdef CONFIG_FS_DAX
 static inline vm_fault_t
 xfs_dax_fault(
@@ -1442,6 +1465,7 @@ xfs_file_mmap(
 
 const struct file_operations xfs_file_operations = {
 	.llseek		= xfs_file_llseek,
+	.llseek_nowait	= xfs_file_llseek_nowait,
 	.read_iter	= xfs_file_read_iter,
 	.write_iter	= xfs_file_write_iter,
 	.splice_read	= xfs_file_splice_read,
@@ -1467,6 +1491,7 @@ const struct file_operations xfs_dir_file_operations = {
 	.read		= generic_read_dir,
 	.iterate_shared	= xfs_file_readdir,
 	.llseek		= generic_file_llseek,
+	.llseek_nowait	= xfs_file_llseek_nowait,
 	.unlocked_ioctl	= xfs_file_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= xfs_file_compat_ioctl,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ