[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251118130705.411336-1-almaz.alexandrovich@paragon-software.com>
Date: Tue, 18 Nov 2025 14:07:05 +0100
From: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
To: <ntfs3@...ts.linux.dev>
CC: <linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
Subject: [PATCH] fs/ntfs3: check for shutdown in fsync
Ensure fsync() returns -EIO when the ntfs3 filesystem is in forced
shutdown, instead of silently succeeding via generic_file_fsync().
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
---
fs/ntfs3/file.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 3b22c7375616..5389b2e17cde 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -1440,6 +1440,18 @@ static ssize_t ntfs_file_splice_write(struct pipe_inode_info *pipe,
return iter_file_splice_write(pipe, file, ppos, len, flags);
}
+/*
+ * ntfs_file_fsync - file_operations::fsync
+ */
+int ntfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
+{
+ struct inode *inode = file_inode(file);
+ if (unlikely(ntfs3_forced_shutdown(inode->i_sb)))
+ return -EIO;
+
+ return generic_file_fsync(file, start, end, datasync);
+}
+
// clang-format off
const struct inode_operations ntfs_file_inode_operations = {
.getattr = ntfs_getattr,
@@ -1465,6 +1477,7 @@ const struct file_operations ntfs_file_operations = {
.fsync = generic_file_fsync,
.fallocate = ntfs_fallocate,
.release = ntfs_file_release,
+ .fsync = ntfs_file_fsync,
};
#if IS_ENABLED(CONFIG_NTFS_FS)
--
2.43.0
Powered by blists - more mailing lists