* [LTP] [PATCH 0/2] ntfs3: Add magic and fix swapfile creation
@ 2026-11-21 0:36 Brian Mak via ltp
2026-11-21 0:36 ` [LTP] [PATCH 1/2] lib: Add ntfs3 magic Brian Mak via ltp
2026-11-21 0:36 ` [LTP] [PATCH 2/2] tse_swap: Fill swapfile with zeroes on ntfs3 Brian Mak via ltp
0 siblings, 2 replies; 5+ messages in thread
From: Brian Mak via ltp @ 2026-11-21 0:36 UTC (permalink / raw)
To: ltp; +Cc: Brian Mak
This patch series adds the ntfs3 magic, allowing prints to show the
correct filesystem name. It also fixes swapfile creation on ntfs3, which
fixes the following test cases on ntfs3: swapon01-03 and swapoff01-02.
These tests fail with:
swapon: swapfile has holes
tse_swap.c:228: TFAIL: swapon() on unknown failed: EINVAL (22)
Brian Mak (2):
lib: Add ntfs3 magic
tse_swap: Fill swapfile with zeroes on ntfs3
include/tst_fs.h | 1 +
lib/tst_fs_type.c | 2 ++
libs/swap/tse_swap.c | 8 ++++++--
3 files changed, 9 insertions(+), 2 deletions(-)
base-commit: 3b962a950b3f37153a45bf1240d07d73ab07676e
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH 1/2] lib: Add ntfs3 magic
2026-11-21 0:36 [LTP] [PATCH 0/2] ntfs3: Add magic and fix swapfile creation Brian Mak via ltp
@ 2026-11-21 0:36 ` Brian Mak via ltp
2026-11-23 12:27 ` Cyril Hrubis
2026-11-21 0:36 ` [LTP] [PATCH 2/2] tse_swap: Fill swapfile with zeroes on ntfs3 Brian Mak via ltp
1 sibling, 1 reply; 5+ messages in thread
From: Brian Mak via ltp @ 2026-11-21 0:36 UTC (permalink / raw)
To: ltp; +Cc: Brian Mak
Tests currently running on ntfs3 print "unknown" as the filesystem name:
tse_swap.c:228: TFAIL: swapon() on unknown failed: EINVAL (22)
Add TST_NTFS3_MAGIC and map it to "ntfs3".
Signed-off-by: Brian Mak <bmak@nvidia.com>
---
include/tst_fs.h | 1 +
lib/tst_fs_type.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/tst_fs.h b/include/tst_fs.h
index 80eb1292e..0a6c863cb 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -34,6 +34,7 @@
#define TST_FUSE_MAGIC 0x65735546
#define TST_VFAT_MAGIC 0x4d44 /* AKA MSDOS */
#define TST_EXFAT_MAGIC 0x2011BAB0UL
+#define TST_NTFS3_MAGIC 0x7366746e
/* fs/bcachefs/bcachefs_format.h */
#define TST_BCACHE_MAGIC 0xca451a4e
diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
index e9efb89dc..703225c09 100644
--- a/lib/tst_fs_type.c
+++ b/lib/tst_fs_type.c
@@ -74,6 +74,8 @@ const char *tst_fs_type_name(long f_type)
return "vfat";
case TST_EXFAT_MAGIC:
return "exfat";
+ case TST_NTFS3_MAGIC:
+ return "ntfs3";
default:
return "unknown";
}
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH 2/2] tse_swap: Fill swapfile with zeroes on ntfs3
2026-11-21 0:36 [LTP] [PATCH 0/2] ntfs3: Add magic and fix swapfile creation Brian Mak via ltp
2026-11-21 0:36 ` [LTP] [PATCH 1/2] lib: Add ntfs3 magic Brian Mak via ltp
@ 2026-11-21 0:36 ` Brian Mak via ltp
2026-11-23 12:16 ` Cyril Hrubis
1 sibling, 1 reply; 5+ messages in thread
From: Brian Mak via ltp @ 2026-11-21 0:36 UTC (permalink / raw)
To: ltp; +Cc: Brian Mak
On ntfs3, fallocate() allocates clusters but does not change the valid
data length.
ntfs3 has no ->swap_activate(), so swapon() maps the file with
generic_swapfile_activate() and ->bmap(). Since ntfs3 was converted to
iomap in v7.0, ntfs_bmap() calls iomap_bmap(), which only returns a
block number for IOMAP_MAPPED extents, while ntfs3 reports the range
beyond the valid data length as IOMAP_UNWRITTEN. swapon() therefore
rejects the file, and swapon01-03 and swapoff01-02 fail on ntfs3 with:
swapon: swapfile has holes
tse_swap.c:228: TFAIL: swapon() on unknown failed: EINVAL (22)
Fill the swapfile with zeroes on ntfs3, as is already done for old XFS,
so that the whole file is written before mkswap and swapon().
Signed-off-by: Brian Mak <bmak@nvidia.com>
---
libs/swap/tse_swap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libs/swap/tse_swap.c b/libs/swap/tse_swap.c
index ae3c19313..a19e97556 100644
--- a/libs/swap/tse_swap.c
+++ b/libs/swap/tse_swap.c
@@ -145,6 +145,7 @@ int make_swapfile(const char *file, const int lineno,
unsigned int blocks = 0;
size_t pg_size = sysconf(_SC_PAGESIZE);
char mnt_path[PATH_MAX];
+ long fs_type;
safe_statvfs(file, lineno, ".", &fs_info);
@@ -177,8 +178,11 @@ int make_swapfile(const char *file, const int lineno,
if (prealloc_contiguous_file(swapfile, blk_size, blocks) != 0)
tst_brk_(file, lineno, TBROK, "Failed to create swapfile");
- /* Fill the file if needed (specific to old xfs filesystems) */
- if (tst_fs_type(swapfile) == TST_XFS_MAGIC) {
+ /*
+ * Fill the file if needed (specific to old XFS and ntfs3)
+ */
+ fs_type = tst_fs_type(swapfile);
+ if (fs_type == TST_XFS_MAGIC || fs_type == TST_NTFS3_MAGIC) {
if (tst_fill_file(swapfile, 0, blk_size, blocks) != 0)
tst_brk_(file, lineno, TBROK, "Failed to fill swapfile");
}
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 2/2] tse_swap: Fill swapfile with zeroes on ntfs3
2026-11-21 0:36 ` [LTP] [PATCH 2/2] tse_swap: Fill swapfile with zeroes on ntfs3 Brian Mak via ltp
@ 2026-11-23 12:16 ` Cyril Hrubis
0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2026-11-23 12:16 UTC (permalink / raw)
To: Brian Mak; +Cc: ltp
Hi!
> On ntfs3, fallocate() allocates clusters but does not change the valid
> data length.
>
> ntfs3 has no ->swap_activate(), so swapon() maps the file with
> generic_swapfile_activate() and ->bmap(). Since ntfs3 was converted to
> iomap in v7.0, ntfs_bmap() calls iomap_bmap(), which only returns a
> block number for IOMAP_MAPPED extents, while ntfs3 reports the range
> beyond the valid data length as IOMAP_UNWRITTEN. swapon() therefore
> rejects the file, and swapon01-03 and swapoff01-02 fail on ntfs3 with:
We had similar bug introduced in exfat code and it was fixed in kernel:
commit 03a43677ca91e3997355a13b1da6e47329b025e1
Author: Jan Polensky <japo@linux.ibm.com>
Date: Tue Jun 9 18:21:49 2026 +0900
exfat: add swap_activate support
Commit 07d67f3e9083 ("exfat: add iomap buffered I/O support")
converted exfat buffered I/O to iomap, but did not add a
.swap_activate handler to the address_space_operations.
Hence I assume this is a kernel bug.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] lib: Add ntfs3 magic
2026-11-21 0:36 ` [LTP] [PATCH 1/2] lib: Add ntfs3 magic Brian Mak via ltp
@ 2026-11-23 12:27 ` Cyril Hrubis
0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2026-11-23 12:27 UTC (permalink / raw)
To: Brian Mak; +Cc: ltp
Hi!
Applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-23 12:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 0:36 [LTP] [PATCH 0/2] ntfs3: Add magic and fix swapfile creation Brian Mak via ltp
2026-11-21 0:36 ` [LTP] [PATCH 1/2] lib: Add ntfs3 magic Brian Mak via ltp
2026-11-23 12:27 ` Cyril Hrubis
2026-11-21 0:36 ` [LTP] [PATCH 2/2] tse_swap: Fill swapfile with zeroes on ntfs3 Brian Mak via ltp
2026-11-23 12:16 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.