fs/ntfs3/file.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
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@paragon-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
Hi Konstantin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.18-rc6 next-20251118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Konstantin-Komarov/fs-ntfs3-check-for-shutdown-in-fsync/20251118-210835
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20251118130705.411336-1-almaz.alexandrovich%40paragon-software.com
patch subject: [PATCH] fs/ntfs3: check for shutdown in fsync
config: arm-randconfig-001-20251119 (https://download.01.org/0day-ci/archive/20251119/202511191144.MLx5UTO4-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251119/202511191144.MLx5UTO4-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511191144.MLx5UTO4-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> fs/ntfs3/file.c:1381:5: warning: no previous prototype for 'ntfs_file_fsync' [-Wmissing-prototypes]
int ntfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
^~~~~~~~~~~~~~~
fs/ntfs3/file.c:1415:12: warning: initialized field overwritten [-Woverride-init]
.fsync = ntfs_file_fsync,
^~~~~~~~~~~~~~~
fs/ntfs3/file.c:1415:12: note: (near initialization for 'ntfs_file_operations.fsync')
vim +/ntfs_file_fsync +1381 fs/ntfs3/file.c
1377
1378 /*
1379 * ntfs_file_fsync - file_operations::fsync
1380 */
> 1381 int ntfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
1382 {
1383 struct inode *inode = file_inode(file);
1384 if (unlikely(ntfs3_forced_shutdown(inode->i_sb)))
1385 return -EIO;
1386
1387 return generic_file_fsync(file, start, end, datasync);
1388 }
1389
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Konstantin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.18-rc6 next-20251118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Konstantin-Komarov/fs-ntfs3-check-for-shutdown-in-fsync/20251118-210835
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20251118130705.411336-1-almaz.alexandrovich%40paragon-software.com
patch subject: [PATCH] fs/ntfs3: check for shutdown in fsync
config: i386-buildonly-randconfig-004-20251119 (https://download.01.org/0day-ci/archive/20251119/202511191004.GdiCxONs-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251119/202511191004.GdiCxONs-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511191004.GdiCxONs-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> fs/ntfs3/file.c:1381:5: warning: no previous prototype for function 'ntfs_file_fsync' [-Wmissing-prototypes]
1381 | int ntfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
| ^
fs/ntfs3/file.c:1381:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
1381 | int ntfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
| ^
| static
fs/ntfs3/file.c:1415:12: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
1415 | .fsync = ntfs_file_fsync,
| ^~~~~~~~~~~~~~~
fs/ntfs3/file.c:1412:12: note: previous initialization is here
1412 | .fsync = generic_file_fsync,
| ^~~~~~~~~~~~~~~~~~
2 warnings generated.
vim +/ntfs_file_fsync +1381 fs/ntfs3/file.c
1377
1378 /*
1379 * ntfs_file_fsync - file_operations::fsync
1380 */
> 1381 int ntfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
1382 {
1383 struct inode *inode = file_inode(file);
1384 if (unlikely(ntfs3_forced_shutdown(inode->i_sb)))
1385 return -EIO;
1386
1387 return generic_file_fsync(file, start, end, datasync);
1388 }
1389
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
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@paragon-software.com>
---
fs/ntfs3/file.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 3b22c7375616..5016bccc2ac5 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
+ */
+static 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,
@@ -1462,7 +1474,7 @@ const struct file_operations ntfs_file_operations = {
.splice_write = ntfs_file_splice_write,
.mmap_prepare = ntfs_file_mmap_prepare,
.open = ntfs_file_open,
- .fsync = generic_file_fsync,
+ .fsync = ntfs_file_fsync,
.fallocate = ntfs_fallocate,
.release = ntfs_file_release,
};
--
2.43.0
© 2016 - 2025 Red Hat, Inc.