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-next>] [day] [month] [year] [list]
Message-Id: <20240923063732.2730521-1-bo.wu@vivo.com>
Date: Mon, 23 Sep 2024 00:37:32 -0600
From: Wu Bo <bo.wu@...o.com>
To: linux-kernel@...r.kernel.org
Cc: Jaegeuk Kim <jaegeuk@...nel.org>,
	Chao Yu <chao@...nel.org>,
	linux-f2fs-devel@...ts.sourceforge.net,
	Wu Bo <wubo.oduw@...il.com>,
	Wu Bo <bo.wu@...o.com>
Subject: [PATCH] f2fs: do not set STATX_DIOALIGN if dio is not supported

According to the definition of statx.stx_mask:
It simply informs the caller which values are supported by the kernel
and filesystem via the statx.stx_mask field.
(quote from the "Linux Programmer's Manual").

Therefore, if the filesystem does not support DIO, it should not set
the STATX_DIOALIGN flag.

Signed-off-by: Wu Bo <bo.wu@...o.com>
---
 fs/f2fs/file.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 168f08507004..bbb66be0deba 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -908,14 +908,13 @@ int f2fs_getattr(struct mnt_idmap *idmap, const struct path *path,
 	 * f2fs sometimes supports DIO reads but not DIO writes.  STATX_DIOALIGN
 	 * cannot represent that, so in that case we report no DIO support.
 	 */
-	if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) {
+	if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode) &&
+			!f2fs_force_buffered_io(inode, WRITE)) {
 		unsigned int bsize = i_blocksize(inode);
 
 		stat->result_mask |= STATX_DIOALIGN;
-		if (!f2fs_force_buffered_io(inode, WRITE)) {
-			stat->dio_mem_align = bsize;
-			stat->dio_offset_align = bsize;
-		}
+		stat->dio_mem_align = bsize;
+		stat->dio_offset_align = bsize;
 	}
 
 	flags = fi->i_flags;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ