fs: Remove NTFS classic
Subsystems (5)
PATCH 1/1 fs: Remove NTFS classic
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
--- CREDITS | 5 + Documentation/filesystems/ntfs.rst | 466 ---- MAINTAINERS | 10 - fs/Kconfig | 1 - fs/Makefile | 1 - fs/ntfs/Kconfig | 81 - fs/ntfs/Makefile | 15 - fs/ntfs/aops.c | 1744 --------------- fs/ntfs/aops.h | 88 - fs/ntfs/attrib.c | 2624 ----------------------- fs/ntfs/attrib.h | 102 - fs/ntfs/bitmap.c | 179 -- fs/ntfs/bitmap.h | 104 - fs/ntfs/collate.c | 110 - fs/ntfs/collate.h | 36 - fs/ntfs/compress.c | 950 --------- fs/ntfs/debug.c | 159 -- fs/ntfs/debug.h | 57 - fs/ntfs/dir.c | 1540 ------------- fs/ntfs/dir.h | 34 - fs/ntfs/endian.h | 79 - fs/ntfs/file.c | 1997 ----------------- fs/ntfs/index.c | 440 ---- fs/ntfs/index.h | 134 -- fs/ntfs/inode.c | 3102 --------------------------- fs/ntfs/inode.h | 310 --- fs/ntfs/layout.h | 2421 --------------------- fs/ntfs/lcnalloc.c | 1000 --------- fs/ntfs/lcnalloc.h | 131 -- fs/ntfs/logfile.c | 849 -------- fs/ntfs/logfile.h | 295 --- fs/ntfs/malloc.h | 77 - fs/ntfs/mft.c | 2907 ------------------------- fs/ntfs/mft.h | 110 - fs/ntfs/mst.c | 189 -- fs/ntfs/namei.c | 392 ---- fs/ntfs/ntfs.h | 150 -- fs/ntfs/quota.c | 103 - fs/ntfs/quota.h | 21 - fs/ntfs/runlist.c | 1893 ---------------- fs/ntfs/runlist.h | 88 - fs/ntfs/super.c | 3202 ---------------------------- fs/ntfs/sysctl.c | 58 - fs/ntfs/sysctl.h | 27 - fs/ntfs/time.h | 89 - fs/ntfs/types.h | 55 - fs/ntfs/unistr.c | 384 ---- fs/ntfs/upcase.c | 73 - fs/ntfs/usnjrnl.c | 70 - fs/ntfs/usnjrnl.h | 191 -- fs/ntfs/volume.h | 164 -- 51 files changed, 5 insertions(+), 29302 deletions(-) delete mode 100644 Documentation/filesystems/ntfs.rst delete mode 100644 fs/ntfs/Kconfig delete mode 100644 fs/ntfs/Makefile delete mode 100644 fs/ntfs/aops.c delete mode 100644 fs/ntfs/aops.h delete mode 100644 fs/ntfs/attrib.c delete mode 100644 fs/ntfs/attrib.h delete mode 100644 fs/ntfs/bitmap.c delete mode 100644 fs/ntfs/bitmap.h delete mode 100644 fs/ntfs/collate.c delete mode 100644 fs/ntfs/collate.h delete mode 100644 fs/ntfs/compress.c delete mode 100644 fs/ntfs/debug.c delete mode 100644 fs/ntfs/debug.h delete mode 100644 fs/ntfs/dir.c delete mode 100644 fs/ntfs/dir.h delete mode 100644 fs/ntfs/endian.h delete mode 100644 fs/ntfs/file.c delete mode 100644 fs/ntfs/index.c delete mode 100644 fs/ntfs/index.h delete mode 100644 fs/ntfs/inode.c delete mode 100644 fs/ntfs/inode.h delete mode 100644 fs/ntfs/layout.h delete mode 100644 fs/ntfs/lcnalloc.c delete mode 100644 fs/ntfs/lcnalloc.h delete mode 100644 fs/ntfs/logfile.c delete mode 100644 fs/ntfs/logfile.h delete mode 100644 fs/ntfs/malloc.h delete mode 100644 fs/ntfs/mft.c delete mode 100644 fs/ntfs/mft.h delete mode 100644 fs/ntfs/mst.c delete mode 100644 fs/ntfs/namei.c delete mode 100644 fs/ntfs/ntfs.h delete mode 100644 fs/ntfs/quota.c delete mode 100644 fs/ntfs/quota.h delete mode 100644 fs/ntfs/runlist.c delete mode 100644 fs/ntfs/runlist.h delete mode 100644 fs/ntfs/super.c delete mode 100644 fs/ntfs/sysctl.c delete mode 100644 fs/ntfs/sysctl.h delete mode 100644 fs/ntfs/time.h delete mode 100644 fs/ntfs/types.h delete mode 100644 fs/ntfs/unistr.c delete mode 100644 fs/ntfs/upcase.c delete mode 100644 fs/ntfs/usnjrnl.c delete mode 100644 fs/ntfs/usnjrnl.h delete mode 100644 fs/ntfs/volume.h
CREDITS +5 -0
@@ -63,6 +63,11 @@ D: dosfs, LILO, some fd features, ATM, various other hacks here and there S: Buenos Aires S: Argentina +NTFS FILESYSTEM +N: Anton Altaparmakov +E: [email protected] +D: NTFS filesystem + N: Tim Alpaerts E: [email protected] D: 802.2 class II logical link control layer,
Documentation/filesystems/ntfs.rst deleted +0 -466
466 lines not on this page · raw message
MAINTAINERS +0 -10
@@ -15460,16 +15460,6 @@ W: https://github.com/davejiang/linux/wiki T: git https://github.com/davejiang/linux.git F: drivers/ntb/hw/intel/ -NTFS FILESYSTEM -M: Anton Altaparmakov <[email protected]> -R: Namjae Jeon <[email protected]> -L: [email protected] -S: Supported -W: http://www.tuxera.com/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git -F: Documentation/filesystems/ntfs.rst -F: fs/ntfs/ - NTFS3 FILESYSTEM M: Konstantin Komarov <[email protected]> L: [email protected]
fs/Kconfig +0 -1
@@ -163,7 +163,6 @@ menu "DOS/FAT/EXFAT/NT Filesystems" source "fs/fat/Kconfig" source "fs/exfat/Kconfig" -source "fs/ntfs/Kconfig" source "fs/ntfs3/Kconfig" endmenu
fs/Makefile +0 -1
@@ -92,7 +92,6 @@ obj-y += unicode/ obj-$(CONFIG_SYSV_FS) += sysv/ obj-$(CONFIG_SMBFS) += smb/ obj-$(CONFIG_HPFS_FS) += hpfs/ -obj-$(CONFIG_NTFS_FS) += ntfs/ obj-$(CONFIG_NTFS3_FS) += ntfs3/ obj-$(CONFIG_UFS_FS) += ufs/ obj-$(CONFIG_EFS_FS) += efs/
fs/ntfs/Kconfig deleted +0 -81
81 lines not on this page · raw message
fs/ntfs/Makefile deleted +0 -15
@@ -1,15 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Rules for making the NTFS driver. - -obj-$(CONFIG_NTFS_FS) += ntfs.o - -ntfs-y := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ - index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ - unistr.o upcase.o - -ntfs-$(CONFIG_NTFS_RW) += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o - -ccflags-y := -DNTFS_VERSION=\"2.1.32\" -ccflags-$(CONFIG_NTFS_DEBUG) += -DDEBUG -ccflags-$(CONFIG_NTFS_RW) += -DNTFS_RW -
fs/ntfs/aops.c deleted +0 -1744
1,744 lines not on this page · raw message
fs/ntfs/aops.h deleted +0 -88
88 lines not on this page · raw message
fs/ntfs/attrib.c deleted +0 -2624
565 lines not on this page · raw message
fs/ntfs/attrib.h deleted +0 -102
102 lines not on this page · raw message
fs/ntfs/bitmap.c deleted +0 -179
179 lines not on this page · raw message
fs/ntfs/bitmap.h deleted +0 -104
104 lines not on this page · raw message
fs/ntfs/collate.c deleted +0 -110
110 lines not on this page · raw message
fs/ntfs/compress.c deleted +0 -950
950 lines not on this page · raw message
fs/ntfs/debug.c deleted +0 -159
159 lines not on this page · raw message
fs/ntfs/debug.h deleted +0 -57
57 lines not on this page · raw message
fs/ntfs/dir.c deleted +0 -1540
1,540 lines not on this page · raw message
fs/ntfs/endian.h deleted +0 -79
79 lines not on this page · raw message
fs/ntfs/file.c deleted +0 -1997
1,997 lines not on this page · raw message
fs/ntfs/index.c deleted +0 -440
440 lines not on this page · raw message
fs/ntfs/index.h deleted +0 -134
134 lines not on this page · raw message
fs/ntfs/inode.c deleted +0 -3102
3,102 lines not on this page · raw message
fs/ntfs/inode.h deleted +0 -310
310 lines not on this page · raw message
fs/ntfs/layout.h deleted +0 -2421
2,421 lines not on this page · raw message
fs/ntfs/lcnalloc.c deleted +0 -1000
1,000 lines not on this page · raw message
fs/ntfs/lcnalloc.h deleted +0 -131
131 lines not on this page · raw message
fs/ntfs/logfile.c deleted +0 -849
849 lines not on this page · raw message
fs/ntfs/logfile.h deleted +0 -295
295 lines not on this page · raw message
fs/ntfs/malloc.h deleted +0 -77
77 lines not on this page · raw message
fs/ntfs/mft.c deleted +0 -2907
2,907 lines not on this page · raw message
fs/ntfs/mft.h deleted +0 -110
110 lines not on this page · raw message
fs/ntfs/mst.c deleted +0 -189
189 lines not on this page · raw message
fs/ntfs/namei.c deleted +0 -392
392 lines not on this page · raw message
fs/ntfs/ntfs.h deleted +0 -150
150 lines not on this page · raw message
fs/ntfs/quota.c deleted +0 -103
103 lines not on this page · raw message
fs/ntfs/runlist.c deleted +0 -1893
1,893 lines not on this page · raw message
fs/ntfs/runlist.h deleted +0 -88
88 lines not on this page · raw message
fs/ntfs/super.c deleted +0 -3202
3,202 lines not on this page · raw message
fs/ntfs/sysctl.c deleted +0 -58
58 lines not on this page · raw message
fs/ntfs/time.h deleted +0 -89
89 lines not on this page · raw message
fs/ntfs/types.h deleted +0 -55
55 lines not on this page · raw message
fs/ntfs/unistr.c deleted +0 -384
384 lines not on this page · raw message
fs/ntfs/upcase.c deleted +0 -73
73 lines not on this page · raw message
fs/ntfs/usnjrnl.c deleted +0 -70
70 lines not on this page · raw message
fs/ntfs/usnjrnl.h deleted +0 -191
191 lines not on this page · raw message
fs/ntfs/volume.h deleted +0 -164
164 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
Hi Matthew,
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
It was my impression that people are complaining ntfs3 is causing a whole lot of problems including corrupting people's data. Also, it appears the maintainer has basically disappeared after it got merged.
Is it really such a good idea to remove the original ntfs driver which actually works fine and does not cause any problems when the replacement is so poor and unmaintained?
Also, which APIs are you referring to? I can take a look into those.
Best regards,
Anton
Signature · 3 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer
Quoted 8 lines · Anton Altaparmakov
Date: Mon, 15 Jan 2024 12:00:35
From: Anton Altaparmakov <[email protected]>
To: "Matthew Wilcox (Oracle)" <[email protected]>,
Christian Brauner <[email protected]>
Cc: [email protected], [email protected],
[email protected], Namjae Jeon <[email protected]>
Subject: Re: [PATCH] fs: Remove NTFS classic
Quoted 8 lines
Hi Matthew,
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
It was my impression that people are complaining ntfs3 is causing a whole lot of problems including corrupting people's data. Also, it appears the maintainer has basically disappeared after it got merged.
To be fair - it's more like "intermittent" maintenance rather than "no maintenance". Konstantin - would it be OK for you to have a co-maintainer to help out?
Enrico
Quoted 14 lines
Is it really such a good idea to remove the original ntfs driver which actually works fine and does not cause any problems when the replacement is so poor and unmaintained?
Also, which APIs are you referring to? I can take a look into those.
Best regards,
Anton
Signature · 3 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer
2024-01-15 20:00 GMT+09:00, Anton Altaparmakov <[email protected]>:
Quoted 10 lines
Hi Matthew,
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
It was my impression that people are complaining ntfs3 is causing a whole lot of problems including corrupting people's data. Also, it appears the maintainer has basically disappeared after it got merged.
What can replace this is not only ntfs3 but also ntfs3g. I think read-only ntfs is obsolete.
I am in favor of remove it.
Thanks.
Quoted 15 lines
Is it really such a good idea to remove the original ntfs driver which actually works fine and does not cause any problems when the replacement is so poor and unmaintained?
Also, which APIs are you referring to? I can take a look into those.
Best regards,
Anton
--
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/
Linux NTFS maintainer
Quoted 10 lines · Anton Altaparmakov
Hi Matthew,
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
It was my impression that people are complaining ntfs3 is causing a whole lot of problems including corrupting people's data. Also, it appears the maintainer has basically disappeared after it got merged.
I'm not terribly happy with how the maintainer behaves either, but you've also been missing in action for nine years (if we're counting code authored by you) or two years (if a R-b is enough).
According to your documentation, you don't support creating new files or directories, so I'd suggest that your code has never been put through the xfstests wringer in the way that ntfs3 has.
Quoted 1 line
Also, which APIs are you referring to? I can take a look into those.
The biggest one for me is the folio work. Everywhere in your code that use a struct page needs to be converted to a struct folio. Support for large folios is optional, and I wouldn't bother trying to add that. Take a look at, eg, nilfs2, ext4, ext2, iomap, NFS, AFS for some filesystems which have been (at least mostly) converted.
Any functions in mm/folio-compat.c should no longer be called.
If we're being really ambitious, filesystems should stop using the buffer cache and switch to using iomap. There's a lot of work going on and unmaintained filesystems are holding us back.
Re: [PATCH] Remove NTFS classic
Hi Matthew,
Quoted 29 lines · Matthew Wilcox
Quoted 10 lines · Anton Altaparmakov
Hi Matthew,
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
It was my impression that people are complaining ntfs3 is causing a whole lot of problems including corrupting people's data. Also, it appears the maintainer has basically disappeared after it got merged.
I'm not terribly happy with how the maintainer behaves either, but you've also been missing in action for nine years (if we're counting code authored by you) or two years (if a R-b is enough).
According to your documentation, you don't support creating new files or directories, so I'd suggest that your code has never been put through the xfstests wringer in the way that ntfs3 has.
Quoted 1 line
Also, which APIs are you referring to? I can take a look into those.
The biggest one for me is the folio work. Everywhere in your code that use a struct page needs to be converted to a struct folio. Support for large folios is optional, and I wouldn't bother trying to add that. Take a look at, eg, nilfs2, ext4, ext2, iomap, NFS, AFS for some filesystems which have been (at least mostly) converted.
Quoted 5 lines
Any functions in
mm/folio-compat.cshould no longer be called.If we're being really ambitious, filesystems should stop using the buffer cache and switch to using iomap. There's a lot of work going on and unmaintained filesystems are holding us back.
Thanks. I would have been happy to do that but it seems everyone else prefers to remove it so I have given my ack for that instead...
Best regards,
Anton
Signature · 3 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer
Quoted 7 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
Signed-off-by Matthew Wilcox (Oracle) <[email protected]>Cc Anton Altaparmakov <[email protected]>Cc Namjae Jeon <[email protected]>
I agree - this is largely untestable code and given the newer, better featured functionality we have (ntfs3, ntfs3g), we should just get rid of this old code.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 5 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
I see no reason to not at least try and remove it given that we have ntfs3 as a replacement. Worst case is we have to put it back in. Let's try it.
---
Applied to the vfs.fs branch of the vfs/vfs.git tree. Patches in the vfs.fs branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fs
[1/1] fs: Remove NTFS classic
https://git.kernel.org/vfs/vfs/c/9c67092ed339
Anton Altaparmakov
Acked-byRe: [PATCH] Remove NTFS classic
Hi,
It seems there is consensus to remove it so please add:
Best regards,
Anton
Quoted 32 lines · Christian Brauner
Quoted 5 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
I see no reason to not at least try and remove it given that we have ntfs3 as a replacement. Worst case is we have to put it back in. Let's try it.
---
Applied to the vfs.fs branch of the vfs/vfs.git tree. Patches in the vfs.fs branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fs[1/1] fs: Remove NTFS classic
https://git.kernel.org/vfs/vfs/c/9c67092ed339
Signature · 3 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer
Christian Brauner
maintainerRe: [PATCH] Remove NTFS classic
Quoted 3 lines · Anton Altaparmakov
Hi,
It seems there is consensus to remove it so please add:
Well, we'll try. This is one of those cases where we might end up not being able to do it. But imho this is a case where there's sufficient reason to at least try and remove this code precisely because we have an alternative implementation that's been around for a while.
IOW, this isn't like reiserfs where we're actually getting rid of a filesystem completely.
Re: [PATCH] Remove NTFS classic
Hi,
Quoted 6 lines · Christian Brauner
Quoted 1 line · Anton Altaparmakov
It seems there is consensus to remove it so please add:
Well, we'll try. This is one of those cases where we might end up not being able to do it.
If that happens, I am happy to update the APIs as Matthew detailed but obviously I do not want to waste my time doing that if it will be removed anyway...
Best regards,
Anton
Quoted 6 lines
But imho this is a case where there's sufficient
reason to at least try and remove this code precisely because we have an alternative implementation that's been around for a while.IOW, this isn't like reiserfs where we're actually getting rid of a filesystem completely.
Signature · 3 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer
Quoted 8 lines · Christian Brauner
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
I see no reason to not at least try and remove it given that we have ntfs3 as a replacement. Worst case is we have to put it back in. Let's try it.
This patch breaks boot of my Lenovo ThinkPad X13s where I have an fstab entry to access firmware from the original Windows partition; ended up in some kind of systemd emergency mode.
Fix is easy enough once I figured out what broke, but requires changing the fs type from 'ntfs' to 'ntfs3' in the fstab (after enabling NTFS3 in the kernel config).
Is it possible to provide an alias or something to avoid breaking people's machines like this? Perhaps something is needed for the Kconfig too.
I also now get a bunch of warning when listing the root directory:
[ 68.967970] ntfs3: nvme0n1p3: ino=130d6, Correct links count -> 1. [ 68.969137] ntfs3: nvme0n1p3: ino=13a, Correct links count -> 1. [ 68.969798] ntfs3: nvme0n1p3: ino=3ad, Correct links count -> 1. [ 68.970431] ntfs3: nvme0n1p3: ino=3d9, Correct links count -> 1. [ 68.971150] ntfs3: nvme0n1p3: ino=26, Correct links count -> 1. [ 68.971780] ntfs3: nvme0n1p3: ino=eb, Correct links count -> 1. [ 68.972263] ntfs3: nvme0n1p3: ino=1ce, Correct links count -> 1. [ 68.973062] ntfs3: nvme0n1p3: ino=a608, Correct links count -> 1.
Flagging this as a regression so that Thorsten is aware of it:
#regzbot introduced: 7ffa8f3d3023
Johan
Christian Brauner
maintainerQuoted 24 lines · Johan Hovold
Quoted 8 lines · Christian Brauner
Quoted 3 lines · Matthew Wilcox (Oracle)
The replacement, NTFS3, was merged over two years ago. It is now time to remove the original from the tree as it is the last user of several APIs, and it is not worth changing.
I see no reason to not at least try and remove it given that we have ntfs3 as a replacement. Worst case is we have to put it back in. Let's try it.
This patch breaks boot of my Lenovo ThinkPad X13s where I have an fstab entry to access firmware from the original Windows partition; ended up in some kind of systemd emergency mode.
Fix is easy enough once I figured out what broke, but requires changing the fs type from 'ntfs' to 'ntfs3' in the fstab (after enabling NTFS3 in the kernel config).
Is it possible to provide an alias or something to avoid breaking people's machines like this? Perhaps something is needed for the
Kconfigtoo.I also now get a bunch of warning when listing the root directory:
Quoted 8 lines
[ 68.967970] ntfs3: nvme0n1p3: ino=130d6, Correct links count -> 1. [ 68.969137] ntfs3: nvme0n1p3: ino=13a, Correct links count -> 1. [ 68.969798] ntfs3: nvme0n1p3: ino=3ad, Correct links count -> 1. [ 68.970431] ntfs3: nvme0n1p3: ino=3d9, Correct links count -> 1. [ 68.971150] ntfs3: nvme0n1p3: ino=26, Correct links count -> 1. [ 68.971780] ntfs3: nvme0n1p3: ino=eb, Correct links count -> 1. [ 68.972263] ntfs3: nvme0n1p3: ino=1ce, Correct links count -> 1. [ 68.973062] ntfs3: nvme0n1p3: ino=a608, Correct links count -> 1.
This shouldn't warn because it's correcting this on the fly.
Quoted 4 lines
Flagging this as a regression so that Thorsten is aware of it:
#regzbot introduced:
7ffa8f3d3023
Thanks for the report. I'll send a fix.
Christian Brauner
maintainerPATCH 1/2 ntfs3: serve as alias for the legacy ntfs driver
In reply to Johan HovoldJohan Hovold reported that removing the legacy ntfs driver broke boot for him since his fstab uses the legacy ntfs driver to access firmware from the original Windows partition.
Use ntfs3 as an alias for legacy ntfs if CONFIG_NTFS_FS is selected. This is similar to how ext3 is treated.
---
Hey,
This is so far compile tested. It would be great if someone could test this. @Johan?
Thanks!
Christian
--- fs/ntfs3/Kconfig | 9 +++++++++ fs/ntfs3/super.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
fs/ntfs3/Kconfig +9 -0
@@ -46,3 +46,12 @@ config NTFS3_FS_POSIX_ACL NOTE: this is linux only feature. Windows will ignore these ACLs. If you don't know what Access Control Lists are, say N. + +config NTFS_FS + tristate "NTFS file system support" + select NTFS3_FS + select BUFFER_HEAD + select NLS + help + This config option is here only for backward compatibility. NTFS + filesystem is now handled by the NTFS3 driver.
fs/ntfs3/super.c +31 -0
@@ -1798,6 +1798,35 @@ static struct file_system_type ntfs_fs_type = { .kill_sb = ntfs3_kill_sb, .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, }; + +#if IS_ENABLED (CONFIG_NTFS_FS ) +static struct file_system_type ntfs_legacy_fs_type = { + .owner =THIS_MODULE , + .name ="ntfs" , + .init_fs_context = ntfs_init_fs_context, + .parameters = ntfs_fs_parameters, + .kill_sb = ntfs3_kill_sb, + .fs_flags =FS_REQUIRES_DEV |FS_ALLOW_IDMAP , +}; +MODULE_ALIAS_FS ("ntfs" ); + +static inline void register_as_ntfs_legacy (void ) +{ +int err =register_filesystem (&ntfs_legacy_fs_type); +if (err) +pr_warn ("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n" , err); +} + +static inline void unregister_as_ntfs_legacy (void ) +{ +unregister_filesystem (&ntfs_legacy_fs_type); +} +#else +static inline void register_as_ntfs_legacy (void ) {} +static inline void unregister_as_ntfs_legacy (void ) {} +#endif + +// clang-format on static int __init init_ntfs_fs (void )
@@ -1832,6 +1861,7 @@ static int __init init_ntfs_fs(void) goto out1; } +register_as_ntfs_legacy (); err =register_filesystem (&ntfs_fs_type);if (err) goto out;
@@ -1849,6 +1879,7 @@ static void __exit exit_ntfs_fs(void)rcu_barrier ();kmem_cache_destroy (ntfs_inode_cachep);unregister_filesystem (&ntfs_fs_type); +unregister_as_ntfs_legacy ();ntfs3_exit_bitmap ();#ifdef CONFIG_PROC_FS
Signature · 1 line
2.43.0
Re: [PATCH 1/2] ntfs3: serve as alias for the legacy ntfs driver
Quoted 12 lines · Christian Brauner
Johan Hovold reported that removing the legacy ntfs driver broke boot for him since his fstab uses the legacy ntfs driver to access firmware from the original Windows partition.
Use ntfs3 as an alias for legacy ntfs if
CONFIG_NTFS_FSis selected. This is similar to how ext3 is treated.Fixes 7ffa8f3d3023 ("fs: Remove NTFS classic")Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>
Quoted 5 lines
---
Hey,This is so far compile tested. It would be great if someone could test this. @Johan?
This seems to do the trick. Thanks for the quick fix.
Do we want to do something about the fact that ntfs mounts may now become writable as well?
Johan
Christian Brauner
maintainerRe: [PATCH 1/2] ntfs3: serve as alias for the legacy ntfs driver
Quoted 19 lines · Johan Hovold
Quoted 12 lines · Christian Brauner
Johan Hovold reported that removing the legacy ntfs driver broke boot for him since his fstab uses the legacy ntfs driver to access firmware from the original Windows partition.
Use ntfs3 as an alias for legacy ntfs if
CONFIG_NTFS_FSis selected. This is similar to how ext3 is treated.Fixes 7ffa8f3d3023 ("fs: Remove NTFS classic")Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>Quoted 5 lines
---
Hey,This is so far compile tested. It would be great if someone could test this. @Johan?
Quoted 6 lines
This seems to do the trick. Thanks for the quick fix.
Tested-by Johan Hovold <[email protected]>Do we want to do something about the fact that ntfs mounts may now become writable as well?
We can enforce that mounting as ntfs means that it's read-only unless rw support is compiled in most likely. @Anton or other maintainers?
Christian Brauner
maintainerPATCH 2/2 ntfs3: remove warning
In reply to Johan HovoldThis causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
--- fs/ntfs3/inode.c | 1 - 1 file changed, 1 deletion(-)
fs/ntfs3/inode.c +0 -1
@@ -424,7 +424,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,if (names !=le16_to_cpu (rec->hard_links)) {/* Correct minor error on the fly. Do not mark inode as dirty. */ -ntfs_inode_warn (inode,"Correct links count -> %u." , names); rec->hard_links =cpu_to_le16 (names); ni->mi.dirty = true; }
Signature · 1 line
2.43.0
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 8 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>
I also see a
ntfs3: Max link count 4000
message on mount which wasn't there with NTFS legacy. Is that benign and should be suppressed too perhaps?
Johan
Christian Brauner
maintainerRe: [PATCH 2/2] ntfs3: remove warning
Quoted 10 lines · Johan Hovold
Quoted 8 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>
Quoted 8 lines
Tested-by Johan Hovold <[email protected]>I also see a
ntfs3: Max link count 4000
message on mount which wasn't there with NTFS legacy. Is that benign and should be suppressed too perhaps?
We need a reply from the ntfs3 maintainers here.
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 13 lines · Christian Brauner
Quoted 12 lines · Johan Hovold
Quoted 8 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>Tested-by Johan Hovold <[email protected]>
Quoted 8 lines
Quoted 6 lines
I also see a
ntfs3: Max link count 4000
message on mount which wasn't there with NTFS legacy. Is that benign and should be suppressed too perhaps?
We need a reply from the ntfs3 maintainers here.
Those are known for taken their time to respond -- like we see here, as nothing happened for 10 days now. Which makes we wonder: should we at least bring the first patch from this series onto the track towards mainline?
FWIW, quick side note: just noticed there was another report about the "Correct links count -> 1." messages:
https://lore.kernel.org/all/[email protected]/
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.
#regzbot duplicate:
https://lore.kernel.org/all/[email protected]/
#regzbot poke
Konstantin Komarov
maintainerRe: [PATCH 2/2] ntfs3: remove warning
Quoted 35 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 12 lines · Christian Brauner
Quoted 11 lines · Johan Hovold
Quoted 8 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>Tested-by Johan Hovold <[email protected]>Quoted 7 lines
Quoted 6 lines
I also see a
ntfs3: Max link count 4000
message on mount which wasn't there with NTFS legacy. Is that benign and should be suppressed too perhaps?
We need a reply from the ntfs3 maintainers here.
Those are known for taken their time to respond -- like we see here, as nothing happened for 10 days now. Which makes we wonder: should we at least bring the first patch from this series onto the track towards mainline?
FWIW, quick side note: just noticed there was another report about the "Correct links count -> 1." messages:
https://lore.kernel.org/all/[email protected]/Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.
Quoted 4 lines
#regzbot duplicate:
https://lore.kernel.org/all/[email protected]/
#regzbot poke
Hello Christian, Johan, all,
There is no problem in suppressing the output of any messages during mounting, like:
fs/ntfs3/super.c +0 -0
@@ -1804,8 +1804,6 @@ static int __init init_ntfs_fs(void)
{
int err;
- pr_info("ntfs3: Max link count %u\n", NTFS_LINK_MAX); -
if (IS_ENABLED(CONFIG_NTFS3_FS_POSIX_ACL)) pr_info("ntfs3: Enabled Linux POSIX ACLs support\n"); if (IS_ENABLED(CONFIG_NTFS3_64BIT_CLUSTER))
Messages like this:
fs/ntfs3/inode.c +0 -0
@@ -424,7 +424,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,
if (names != le16_to_cpu(rec->hard_links)) {
/* Correct minor error on the fly. Do not mark inode as dirty. */ - ntfs_inode_warn(inode, "Correct links count -> %u.", names); rec->hard_links = cpu_to_le16(names);
ni->mi.dirty = true;
}
can also be suppressed for the sake of seamless transition from a remote NTFS driver. However, I believe that file system corrections should be reported to the user.
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 39 lines · Konstantin Komarov
Quoted 13 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 12 lines · Christian Brauner
Quoted 11 lines · Johan Hovold
Quoted 8 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>Tested-by Johan Hovold <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I also see a
ntfs3: Max link count 4000
message on mount which wasn't there with NTFS legacy. Is that benign and should be suppressed too perhaps?
We need a reply from the ntfs3 maintainers here.
There is no problem in suppressing the output of any messages during mounting, like:
Messages like this:
fs/ntfs3/inode.c +0
-1@@ -424,7 +424,6 @@ static struct inode *ntfs_read_mft(struct inode *inode, if (names != le16_to_cpu(rec->hard_links)) { /* Correct minor error on the fly. Do not mark inode as dirty. */ - ntfs_inode_warn(inode, "Correct links count -> %u.", names); rec->hard_links = cpu_to_le16(names); ni->mi.dirty = true; }
Quoted 4 lines
can also be suppressed for the sake of seamless transition from a remote NTFS driver.
However, I believe that file system corrections should be reported to the user.
A colleague of mine also tracked down a failed boot to the removal of the ntfs driver and reported seeing similar warnings with the ntfs3 driver.
We're both accessing an NTFS partition on a Windows on Arm device, but it makes you wonder whether these warnings (corrections) are correct or indicative of a problem in the driver?
Johan
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 25 lines · Johan Hovold
Quoted 14 lines · Konstantin Komarov
Messages like this:
fs/ntfs3/inode.c +0
-1@@ -424,7 +424,6 @@ static struct inode *ntfs_read_mft(struct inode *inode, if (names != le16_to_cpu(rec->hard_links)) { /* Correct minor error on the fly. Do not mark inode as dirty. */ - ntfs_inode_warn(inode, "Correct links count -> %u.", names); rec->hard_links = cpu_to_le16(names); ni->mi.dirty = true; }Quoted 4 lines
can also be suppressed for the sake of seamless transition from a remote NTFS driver.
However, I believe that file system corrections should be reported to the user.A colleague of mine also tracked down a failed boot to the removal of the ntfs driver and reported seeing similar warnings with the ntfs3 driver.
Quoted 3 lines
We're both accessing an NTFS partition on a Windows on Arm device, but it makes you wonder whether these warnings (corrections) are correct or indicative of a problem in the driver?
This is what I see with a recursive ls on that partition (I've added rec->hard_links in parentheses):
[ 38.287555] ntfs3: nvme0n1p3: ino=2e1e7, Correct links count -> 1 (2). [ 38.288593] ntfs3: nvme0n1p3: ino=75ff, Correct links count -> 1 (2). [ 38.289887] ntfs3: nvme0n1p3: ino=1b4e1, Correct links count -> 1 (2). [ 38.290144] ntfs3: nvme0n1p3: ino=78c6, Correct links count -> 1 (2). [ 38.291313] ntfs3: nvme0n1p3: ino=8781b, Correct links count -> 1 (2). [ 38.291823] ntfs3: nvme0n1p3: ino=8781e, Correct links count -> 1 (2). [ 38.292289] ntfs3: nvme0n1p3: ino=87820, Correct links count -> 1 (2). [ 38.292978] ntfs3: nvme0n1p3: ino=87823, Correct links count -> 1 (2). [ 38.300531] ntfs3: nvme0n1p3: ino=a324, Correct links count -> 1 (2). [ 38.312235] ntfs3: nvme0n1p3: ino=882c3, Correct links count -> 1 (2). [ 43.286846] ntfs3: 5479 callbacks suppressed [ 43.286856] ntfs3: nvme0n1p3: ino=14aa, Correct links count -> 1 (2). [ 43.286998] ntfs3: nvme0n1p3: ino=14ac, Correct links count -> 1 (2). [ 43.287194] ntfs3: nvme0n1p3: ino=12cc2, Correct links count -> 1 (2). [ 43.287386] ntfs3: nvme0n1p3: ino=12ccd, Correct links count -> 1 (2). [ 43.287576] ntfs3: nvme0n1p3: ino=12d15, Correct links count -> 1 (2). [ 43.287667] ntfs3: nvme0n1p3: ino=12d19, Correct links count -> 1 (2). [ 43.287877] ntfs3: nvme0n1p3: ino=12d3a, Correct links count -> 1 (2). [ 43.288051] ntfs3: nvme0n1p3: ino=12d88, Correct links count -> 1 (2). [ 43.288265] ntfs3: nvme0n1p3: ino=874, Correct links count -> 1 (2). [ 43.288326] ntfs3: nvme0n1p3: ino=875, Correct links count -> 1 (2). [ 48.288211] ntfs3: 7735 callbacks suppressed [ 48.288220] ntfs3: nvme0n1p3: ino=33391, Correct links count -> 1 (2). [ 48.289115] ntfs3: nvme0n1p3: ino=347a4, Correct links count -> 1 (2). [ 48.290214] ntfs3: nvme0n1p3: ino=3553f, Correct links count -> 1 (2). [ 48.291193] ntfs3: nvme0n1p3: ino=35793, Correct links count -> 1 (2). [ 48.292818] ntfs3: nvme0n1p3: ino=358a0, Correct links count -> 1 (2). [ 48.293529] ntfs3: nvme0n1p3: ino=38f54, Correct links count -> 1 (2). [ 48.293901] ntfs3: nvme0n1p3: ino=391f6, Correct links count -> 1 (2). [ 48.294303] ntfs3: nvme0n1p3: ino=39324, Correct links count -> 1 (2). [ 48.294729] ntfs3: nvme0n1p3: ino=394a0, Correct links count -> 1 (2). [ 48.295063] ntfs3: nvme0n1p3: ino=3956a, Correct links count -> 1 (2). [ 53.289392] ntfs3: 11442 callbacks suppressed [ 53.289401] ntfs3: nvme0n1p3: ino=6293e, Correct links count -> 1 (2). [ 53.289972] ntfs3: nvme0n1p3: ino=61df1, Correct links count -> 1 (2). [ 53.290241] ntfs3: nvme0n1p3: ino=61df3, Correct links count -> 1 (2). [ 53.290578] ntfs3: nvme0n1p3: ino=61f3b, Correct links count -> 1 (2). [ 53.290881] ntfs3: nvme0n1p3: ino=62025, Correct links count -> 1 (2). [ 53.291045] ntfs3: nvme0n1p3: ino=629af, Correct links count -> 1 (2). [ 53.291181] ntfs3: nvme0n1p3: ino=61e3c, Correct links count -> 1 (2). [ 53.291463] ntfs3: nvme0n1p3: ino=61e22, Correct links count -> 1 (2). [ 53.291743] ntfs3: nvme0n1p3: ino=62882, Correct links count -> 1 (2). [ 53.292099] ntfs3: nvme0n1p3: ino=61b3d, Correct links count -> 1 (2). [ 58.291790] ntfs3: 5373 callbacks suppressed [ 58.291799] ntfs3: nvme0n1p3: ino=6d5a5, Correct links count -> 1 (2). [ 58.292106] ntfs3: nvme0n1p3: ino=6d7f6, Correct links count -> 1 (2). [ 58.292372] ntfs3: nvme0n1p3: ino=6db43, Correct links count -> 1 (2). [ 58.292653] ntfs3: nvme0n1p3: ino=72557, Correct links count -> 1 (2). [ 58.293244] ntfs3: nvme0n1p3: ino=728d8, Correct links count -> 1 (2). [ 58.294306] ntfs3: nvme0n1p3: ino=72c6e, Correct links count -> 1 (2). [ 58.294944] ntfs3: nvme0n1p3: ino=72ff7, Correct links count -> 1 (2). [ 58.295666] ntfs3: nvme0n1p3: ino=73271, Correct links count -> 1 (2). [ 58.296281] ntfs3: nvme0n1p3: ino=735fd, Correct links count -> 1 (2). [ 58.296991] ntfs3: nvme0n1p3: ino=73880, Correct links count -> 1 (2). [ 63.295009] ntfs3: 13921 callbacks suppressed [ 63.295017] ntfs3: nvme0n1p3: ino=6be65, Correct links count -> 1 (2). [ 63.295902] ntfs3: nvme0n1p3: ino=6c08e, Correct links count -> 1 (2). [ 63.296252] ntfs3: nvme0n1p3: ino=6c2e3, Correct links count -> 1 (2). [ 63.297581] ntfs3: nvme0n1p3: ino=6c610, Correct links count -> 1 (2). [ 63.298321] ntfs3: nvme0n1p3: ino=6c7f9, Correct links count -> 1 (2). [ 63.298730] ntfs3: nvme0n1p3: ino=6cb24, Correct links count -> 1 (2). [ 63.299079] ntfs3: nvme0n1p3: ino=6ceda, Correct links count -> 1 (2). [ 63.299408] ntfs3: nvme0n1p3: ino=6d288, Correct links count -> 1 (2). [ 63.299727] ntfs3: nvme0n1p3: ino=6d533, Correct links count -> 1 (2). [ 63.300080] ntfs3: nvme0n1p3: ino=6d77b, Correct links count -> 1 (2). [ 68.299457] ntfs3: 8228 callbacks suppressed [ 68.299467] ntfs3: nvme0n1p3: ino=3e248, Correct links count -> 1 (2). [ 68.301391] ntfs3: nvme0n1p3: ino=5d7b7, Correct links count -> 1 (2). [ 68.302440] ntfs3: nvme0n1p3: ino=5853d, Correct links count -> 1 (2). [ 68.303123] ntfs3: nvme0n1p3: ino=3ca2e, Correct links count -> 1 (2). [ 68.303722] ntfs3: nvme0n1p3: ino=59a98, Correct links count -> 1 (2). [ 68.304292] ntfs3: nvme0n1p3: ino=59a9b, Correct links count -> 1 (2). [ 68.304981] ntfs3: nvme0n1p3: ino=59a9e, Correct links count -> 1 (2). [ 68.305629] ntfs3: nvme0n1p3: ino=59aa1, Correct links count -> 1 (2). [ 68.306120] ntfs3: nvme0n1p3: ino=3214f, Correct links count -> 1 (2). [ 68.306539] ntfs3: nvme0n1p3: ino=2077b, Correct links count -> 1 (2). [ 73.302727] ntfs3: 8502 callbacks suppressed [ 73.302736] ntfs3: nvme0n1p3: ino=5aa99, Correct links count -> 1 (2). [ 73.303992] ntfs3: nvme0n1p3: ino=50ee9, Correct links count -> 1 (2). [ 73.304744] ntfs3: nvme0n1p3: ino=20420, Correct links count -> 1 (2). [ 73.305080] ntfs3: nvme0n1p3: ino=258c, Correct links count -> 1 (2). [ 73.305470] ntfs3: nvme0n1p3: ino=5a30d, Correct links count -> 1 (2). [ 73.307283] ntfs3: nvme0n1p3: ino=5a54c, Correct links count -> 1 (2). [ 73.307890] ntfs3: nvme0n1p3: ino=5c9de, Correct links count -> 1 (2). [ 73.308495] ntfs3: nvme0n1p3: ino=3d82d, Correct links count -> 1 (2). [ 73.309581] ntfs3: nvme0n1p3: ino=3d839, Correct links count -> 1 (2). [ 73.310016] ntfs3: nvme0n1p3: ino=25c77, Correct links count -> 1 (2). [ 78.304861] ntfs3: 11462 callbacks suppressed [ 78.304868] ntfs3: nvme0n1p3: ino=5c714, Correct links count -> 1 (2). [ 78.305579] ntfs3: nvme0n1p3: ino=57d11, Correct links count -> 1 (2). [ 78.306151] ntfs3: nvme0n1p3: ino=5842d, Correct links count -> 1 (2). [ 78.307412] ntfs3: nvme0n1p3: ino=34e6, Correct links count -> 1 (3). [ 78.307843] ntfs3: nvme0n1p3: ino=5bb23, Correct links count -> 1 (2). [ 78.308509] ntfs3: nvme0n1p3: ino=5c722, Correct links count -> 1 (2). [ 78.310018] ntfs3: nvme0n1p3: ino=5d761, Correct links count -> 1 (2). [ 78.310717] ntfs3: nvme0n1p3: ino=33d18, Correct links count -> 1 (3). [ 78.311179] ntfs3: nvme0n1p3: ino=5d75b, Correct links count -> 1 (3). [ 78.311605] ntfs3: nvme0n1p3: ino=5c708, Correct links count -> 1 (3).
Johan
Re: [PATCH 2/2] ntfs3: remove warning
Hi,
Had a look at ntfs3 code and it is corrupting your volume. Every such message you are seeing is damaging a file or directory on your volume.
I would personally suggest you modify your /etc/fstab to mount read-only. If it is getting simple things like this wrong who knows what else it is doing incorrect...
Best regards,
Anton
Quoted 135 lines · Johan Hovold
Quoted 25 lines · Johan Hovold
Quoted 14 lines · Konstantin Komarov
Messages like this:
fs/ntfs3/inode.c +0
-1@@ -424,7 +424,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,if (names !=le16_to_cpu (rec->hard_links)) {/* Correct minor error on the fly. Do not mark inode as dirty. */ -ntfs_inode_warn (inode,"Correct links count -> %u." , names); rec->hard_links =cpu_to_le16 (names); ni->mi.dirty = true; }Quoted 4 lines
can also be suppressed for the sake of seamless transition from a remote NTFS driver.
However, I believe that file system corrections should be reported to the user.A colleague of mine also tracked down a failed boot to the removal of the ntfs driver and reported seeing similar warnings with the ntfs3 driver.
Quoted 3 lines
We're both accessing an NTFS partition on a Windows on Arm device, but it makes you wonder whether these warnings (corrections) are correct or indicative of a problem in the driver?
This is what I see with a recursive ls on that partition (I've added
rec->hard_linksin parentheses):[ 38.287555] ntfs3: nvme0n1p3: ino=2e1e7, Correct links count -> 1 (2). [ 38.288593] ntfs3: nvme0n1p3: ino=75ff, Correct links count -> 1 (2). [ 38.289887] ntfs3: nvme0n1p3: ino=1b4e1, Correct links count -> 1 (2). [ 38.290144] ntfs3: nvme0n1p3: ino=78c6, Correct links count -> 1 (2). [ 38.291313] ntfs3: nvme0n1p3: ino=8781b, Correct links count -> 1 (2). [ 38.291823] ntfs3: nvme0n1p3: ino=8781e, Correct links count -> 1 (2). [ 38.292289] ntfs3: nvme0n1p3: ino=87820, Correct links count -> 1 (2). [ 38.292978] ntfs3: nvme0n1p3: ino=87823, Correct links count -> 1 (2). [ 38.300531] ntfs3: nvme0n1p3: ino=a324, Correct links count -> 1 (2). [ 38.312235] ntfs3: nvme0n1p3: ino=882c3, Correct links count -> 1 (2). [ 43.286846] ntfs3: 5479 callbacks suppressed [ 43.286856] ntfs3: nvme0n1p3: ino=14aa, Correct links count -> 1 (2). [ 43.286998] ntfs3: nvme0n1p3: ino=14ac, Correct links count -> 1 (2). [ 43.287194] ntfs3: nvme0n1p3: ino=12cc2, Correct links count -> 1 (2). [ 43.287386] ntfs3: nvme0n1p3: ino=12ccd, Correct links count -> 1 (2). [ 43.287576] ntfs3: nvme0n1p3: ino=12d15, Correct links count -> 1 (2). [ 43.287667] ntfs3: nvme0n1p3: ino=12d19, Correct links count -> 1 (2). [ 43.287877] ntfs3: nvme0n1p3: ino=12d3a, Correct links count -> 1 (2). [ 43.288051] ntfs3: nvme0n1p3: ino=12d88, Correct links count -> 1 (2). [ 43.288265] ntfs3: nvme0n1p3: ino=874, Correct links count -> 1 (2). [ 43.288326] ntfs3: nvme0n1p3: ino=875, Correct links count -> 1 (2). [ 48.288211] ntfs3: 7735 callbacks suppressed [ 48.288220] ntfs3: nvme0n1p3: ino=33391, Correct links count -> 1 (2). [ 48.289115] ntfs3: nvme0n1p3: ino=347a4, Correct links count -> 1 (2). [ 48.290214] ntfs3: nvme0n1p3: ino=3553f, Correct links count -> 1 (2). [ 48.291193] ntfs3: nvme0n1p3: ino=35793, Correct links count -> 1 (2). [ 48.292818] ntfs3: nvme0n1p3: ino=358a0, Correct links count -> 1 (2). [ 48.293529] ntfs3: nvme0n1p3: ino=38f54, Correct links count -> 1 (2). [ 48.293901] ntfs3: nvme0n1p3: ino=391f6, Correct links count -> 1 (2). [ 48.294303] ntfs3: nvme0n1p3: ino=39324, Correct links count -> 1 (2). [ 48.294729] ntfs3: nvme0n1p3: ino=394a0, Correct links count -> 1 (2). [ 48.295063] ntfs3: nvme0n1p3: ino=3956a, Correct links count -> 1 (2). [ 53.289392] ntfs3: 11442 callbacks suppressed [ 53.289401] ntfs3: nvme0n1p3: ino=6293e, Correct links count -> 1 (2). [ 53.289972] ntfs3: nvme0n1p3: ino=61df1, Correct links count -> 1 (2). [ 53.290241] ntfs3: nvme0n1p3: ino=61df3, Correct links count -> 1 (2). [ 53.290578] ntfs3: nvme0n1p3: ino=61f3b, Correct links count -> 1 (2). [ 53.290881] ntfs3: nvme0n1p3: ino=62025, Correct links count -> 1 (2). [ 53.291045] ntfs3: nvme0n1p3: ino=629af, Correct links count -> 1 (2). [ 53.291181] ntfs3: nvme0n1p3: ino=61e3c, Correct links count -> 1 (2). [ 53.291463] ntfs3: nvme0n1p3: ino=61e22, Correct links count -> 1 (2). [ 53.291743] ntfs3: nvme0n1p3: ino=62882, Correct links count -> 1 (2). [ 53.292099] ntfs3: nvme0n1p3: ino=61b3d, Correct links count -> 1 (2). [ 58.291790] ntfs3: 5373 callbacks suppressed [ 58.291799] ntfs3: nvme0n1p3: ino=6d5a5, Correct links count -> 1 (2). [ 58.292106] ntfs3: nvme0n1p3: ino=6d7f6, Correct links count -> 1 (2). [ 58.292372] ntfs3: nvme0n1p3: ino=6db43, Correct links count -> 1 (2). [ 58.292653] ntfs3: nvme0n1p3: ino=72557, Correct links count -> 1 (2). [ 58.293244] ntfs3: nvme0n1p3: ino=728d8, Correct links count -> 1 (2). [ 58.294306] ntfs3: nvme0n1p3: ino=72c6e, Correct links count -> 1 (2). [ 58.294944] ntfs3: nvme0n1p3: ino=72ff7, Correct links count -> 1 (2). [ 58.295666] ntfs3: nvme0n1p3: ino=73271, Correct links count -> 1 (2). [ 58.296281] ntfs3: nvme0n1p3: ino=735fd, Correct links count -> 1 (2). [ 58.296991] ntfs3: nvme0n1p3: ino=73880, Correct links count -> 1 (2). [ 63.295009] ntfs3: 13921 callbacks suppressed [ 63.295017] ntfs3: nvme0n1p3: ino=6be65, Correct links count -> 1 (2). [ 63.295902] ntfs3: nvme0n1p3: ino=6c08e, Correct links count -> 1 (2). [ 63.296252] ntfs3: nvme0n1p3: ino=6c2e3, Correct links count -> 1 (2). [ 63.297581] ntfs3: nvme0n1p3: ino=6c610, Correct links count -> 1 (2). [ 63.298321] ntfs3: nvme0n1p3: ino=6c7f9, Correct links count -> 1 (2). [ 63.298730] ntfs3: nvme0n1p3: ino=6cb24, Correct links count -> 1 (2). [ 63.299079] ntfs3: nvme0n1p3: ino=6ceda, Correct links count -> 1 (2). [ 63.299408] ntfs3: nvme0n1p3: ino=6d288, Correct links count -> 1 (2). [ 63.299727] ntfs3: nvme0n1p3: ino=6d533, Correct links count -> 1 (2). [ 63.300080] ntfs3: nvme0n1p3: ino=6d77b, Correct links count -> 1 (2). [ 68.299457] ntfs3: 8228 callbacks suppressed [ 68.299467] ntfs3: nvme0n1p3: ino=3e248, Correct links count -> 1 (2). [ 68.301391] ntfs3: nvme0n1p3: ino=5d7b7, Correct links count -> 1 (2). [ 68.302440] ntfs3: nvme0n1p3: ino=5853d, Correct links count -> 1 (2). [ 68.303123] ntfs3: nvme0n1p3: ino=3ca2e, Correct links count -> 1 (2). [ 68.303722] ntfs3: nvme0n1p3: ino=59a98, Correct links count -> 1 (2). [ 68.304292] ntfs3: nvme0n1p3: ino=59a9b, Correct links count -> 1 (2). [ 68.304981] ntfs3: nvme0n1p3: ino=59a9e, Correct links count -> 1 (2). [ 68.305629] ntfs3: nvme0n1p3: ino=59aa1, Correct links count -> 1 (2). [ 68.306120] ntfs3: nvme0n1p3: ino=3214f, Correct links count -> 1 (2). [ 68.306539] ntfs3: nvme0n1p3: ino=2077b, Correct links count -> 1 (2). [ 73.302727] ntfs3: 8502 callbacks suppressed [ 73.302736] ntfs3: nvme0n1p3: ino=5aa99, Correct links count -> 1 (2). [ 73.303992] ntfs3: nvme0n1p3: ino=50ee9, Correct links count -> 1 (2). [ 73.304744] ntfs3: nvme0n1p3: ino=20420, Correct links count -> 1 (2). [ 73.305080] ntfs3: nvme0n1p3: ino=258c, Correct links count -> 1 (2). [ 73.305470] ntfs3: nvme0n1p3: ino=5a30d, Correct links count -> 1 (2). [ 73.307283] ntfs3: nvme0n1p3: ino=5a54c, Correct links count -> 1 (2). [ 73.307890] ntfs3: nvme0n1p3: ino=5c9de, Correct links count -> 1 (2). [ 73.308495] ntfs3: nvme0n1p3: ino=3d82d, Correct links count -> 1 (2). [ 73.309581] ntfs3: nvme0n1p3: ino=3d839, Correct links count -> 1 (2). [ 73.310016] ntfs3: nvme0n1p3: ino=25c77, Correct links count -> 1 (2). [ 78.304861] ntfs3: 11462 callbacks suppressed [ 78.304868] ntfs3: nvme0n1p3: ino=5c714, Correct links count -> 1 (2). [ 78.305579] ntfs3: nvme0n1p3: ino=57d11, Correct links count -> 1 (2). [ 78.306151] ntfs3: nvme0n1p3: ino=5842d, Correct links count -> 1 (2). [ 78.307412] ntfs3: nvme0n1p3: ino=34e6, Correct links count -> 1 (3). [ 78.307843] ntfs3: nvme0n1p3: ino=5bb23, Correct links count -> 1 (2). [ 78.308509] ntfs3: nvme0n1p3: ino=5c722, Correct links count -> 1 (2). [ 78.310018] ntfs3: nvme0n1p3: ino=5d761, Correct links count -> 1 (2). [ 78.310717] ntfs3: nvme0n1p3: ino=33d18, Correct links count -> 1 (3). [ 78.311179] ntfs3: nvme0n1p3: ino=5d75b, Correct links count -> 1 (3). [ 78.311605] ntfs3: nvme0n1p3: ino=5c708, Correct links count -> 1 (3).Johan
Signature · 2 lines
Anton Altaparmakov <anton at tuxera.com> (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 2 lines · Anton Altaparmakov
Had a look at ntfs3 code and it is corrupting your volume. Every such message you are seeing is damaging a file or directory on your volume.
That's what I feared, thanks for confirming.
Quoted 3 lines
I would personally suggest you modify your
/etc/fstabto mount read-only. If it is getting simple things like this wrong who knows what else it is doing incorrect...
I fully agree and that's partly also why I asked Christian to make sure that the alias fs type is always mounted RO.
But it seems we have a bigger problem here and should just restore the old ntfs driver for now.
Johan
Christian Brauner
maintainerRe: [PATCH 2/2] ntfs3: remove warning
Quoted 11 lines · Johan Hovold
Quoted 2 lines · Anton Altaparmakov
Had a look at ntfs3 code and it is corrupting your volume. Every such message you are seeing is damaging a file or directory on your volume.
That's what I feared, thanks for confirming.
Quoted 3 lines
I would personally suggest you modify your
/etc/fstabto mount read-only. If it is getting simple things like this wrong who knows what else it is doing incorrect...
Quoted 5 lines
I fully agree and that's partly also why I asked Christian to make sure that the alias fs type is always mounted RO.
But it seems we have a bigger problem here and should just restore the old ntfs driver for now.
Hey Linus,
A brief summary:
The removal of the legacy ntfs driver has caused a regression for some users that rely on the legacy ntfs driver to be available during boot. The affected user here is Johan (Cc'ed). In addition he's seeing dmesg warnings that he didn't see before with the legacy ntfs driver.
I see the following options to resolve this:
(1) Since the ntfs3 driver is supposed to serve as a drop-in replacement for the legacy ntfs driver we should to it the same way we did it for ext3 and ext4 where ext4 registers itself also for the ext3 driver. In other words, we would register ntfs3 as ntfs3 filesystem type and as legacy ntfs filesystem type. To make it fully compatible we also need to make sure it's persistently mounted read-only.
(2) We revert the ntfs driver (for now) as we are in the middle of the cycle.
If you decide (2) is the right way to go then I would suggest we try the removal once more next cycle with the proposed change in (1) in place if you're up for that.
Christian
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 6 lines · Christian Brauner
(1) Since the ntfs3 driver is supposed to serve as a drop-in replacement for the legacy ntfs driver we should to it the same way we did it for ext3 and ext4 where ext4 registers itself also for the ext3 driver. In other words, we would register ntfs3 as ntfs3 filesystem type and as legacy ntfs filesystem type.
I think that if just registering it under the same name solves the immediate issue, that's the one we should just go for.
Quoted 2 lines
To make it fully compatible
we also need to make sure it's persistently mounted read-only.
My reaction to that is "only if it turns out we really need to".
It sounds unlikely that somebody has an old ntfs setup and then tries to mount things rw which didn't use to work and things go sideways if that then suddenly works.
But "unlikely" isn't "impossible", of course - it's just that I'd suggest we actually wait for that report to happen and ask what the heck they were doing and why they were doing that...
Linus
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 10 lines · Linus Torvalds
Quoted 6 lines · Christian Brauner
(1) Since the ntfs3 driver is supposed to serve as a drop-in replacement for the legacy ntfs driver we should to it the same way we did it for ext3 and ext4 where ext4 registers itself also for the ext3 driver. In other words, we would register ntfs3 as ntfs3 filesystem type and as legacy ntfs filesystem type.
I think that if just registering it under the same name solves the immediate issue, that's the one we should just go for.
I agree.
Quoted 4 lines
Quoted 2 lines
To make it fully compatible
we also need to make sure it's persistently mounted read-only.My reaction to that is "only if it turns out we really need to".
Unfortunately, we do. It seems that ntfs3 has some bugs, and (according to Anton, the ntfs-classic maintainer) it's actually corrupting perfectly good filesystems. I'd expected that this kind of bug would have been shaken out by now (it's been in the kernel for over two and a half years!) but it seems like people just haven't been using it.
Re: [PATCH 2/2] ntfs3: remove warning
In reply to Linus TorvaldsQuoted 10 lines · Linus Torvalds
Quoted 6 lines · Christian Brauner
(1) Since the ntfs3 driver is supposed to serve as a drop-in replacement for the legacy ntfs driver we should to it the same way we did it for ext3 and ext4 where ext4 registers itself also for the ext3 driver. In other words, we would register ntfs3 as ntfs3 filesystem type and as legacy ntfs filesystem type.
I think that if just registering it under the same name solves the immediate issue, that's the one we should just go for.
I also tend to agree, but...
Quoted 5 lines
Quoted 2 lines
To make it fully compatible
we also need to make sure it's persistently mounted read-only.My reaction to that is "only if it turns out we really need to".
Quoted 7 lines
It sounds unlikely that somebody has an old ntfs setup and then tries to mount things rw which didn't use to work and things go sideways if that then suddenly works.
But "unlikely" isn't "impossible", of course - it's just that I'd suggest we actually wait for that report to happen and ask what the heck they were doing and why they were doing that...
I think the "ntfs" alias must always be mounted read-only because you can currently have an fstab entry which does not specify "ro" and this mount would suddenly become writeable when updating to 6.9 (possibly by a non-privileged user, etc).
We also need to do something about the ntfs3 driver spamming the logs about broken corrections also when mounted read-only even if it doesn't eat your filesystem then.
And it seems write-support should be disabled in the driver by default until someone has tracked down why listing a directory can currently corrupt your filesystem.
Johan
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 5 lines · Johan Hovold
I think the "ntfs" alias must always be mounted read-only because you can currently have an fstab entry which does not specify "ro" and this mount would suddenly become writeable when updating to 6.9 (possibly by a non-privileged user, etc).
Well, it would be fairly easy to do particularly if we just do it for the old legacy case.
Of course, even the legacy case had that CONFIG_NTFS_RW option, so people who depended on _that_ would want to be able to remount...
Linus
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Johan Hovold
I think the "ntfs" alias must always be mounted read-only because you can currently have an fstab entry which does not specify "ro" and this mount would suddenly become writeable when updating to 6.9 (possibly by a non-privileged user, etc).
Quoted 5 lines
Well, it would be fairly easy to do particularly if we just do it for the old legacy case.
Of course, even the legacy case had that
CONFIG_NTFS_RWoption, so people who depended on _that_ would want to be able to remount...
Ah, right, I forgot about CONFIG_NTFS_RW as I've never enabled it.
Judging from the now removed Kconfig entry perhaps not that many people did:
The only supported operation is overwriting existing files, without changing the file length. No file or directory creation, deletion or renaming is possible.
but I guess it still makes my argument above mostly moot.
At least if we disable write support in ntfs3 by default for now...
Johan
Christian Brauner
maintainerRe: [PATCH 2/2] ntfs3: remove warning
Quoted 19 lines · Johan Hovold
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Johan Hovold
I think the "ntfs" alias must always be mounted read-only because you can currently have an fstab entry which does not specify "ro" and this mount would suddenly become writeable when updating to 6.9 (possibly by a non-privileged user, etc).
Quoted 5 lines
Well, it would be fairly easy to do particularly if we just do it for the old legacy case.
Of course, even the legacy case had that
CONFIG_NTFS_RWoption, so people who depended on _that_ would want to be able to remount...Ah, right, I forgot about
CONFIG_NTFS_RWas I've never enabled it.Judging from the now removed
Kconfigentry perhaps not that many people did:
Quoted 7 lines
The only supported operation is overwriting existing files, without changing the file length. No file or directory creation, deletion or renaming is possible.
but I guess it still makes my argument above mostly moot.
At least if we disable write support in ntfs3 by default for now...
I think we can disable write support in ntfs3 for now. I've picked up the patch to make ntfs3 serve I sent some time ago that Johan tested now.
The only thing left is to disable write support for ntfs3 as legacy ntfs driver for now. I took a stab at this. The following two patches I'm appending _should_ be enough iiuc. Johan, please take a look and please test.
This is also available on:
https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.fixes
So feel free to pull from there and look there as well.
From 1a2af5ca9b66bd3d4040f9987c78faff128e552f Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Tue, 16 Apr 2024 12:08:51 +0200
Subject: [PATCH 1/2] ntfs3: enforce read-only when used as legacy ntfs driver
Ensure that ntfs3 is mounted read-only when it is used to provide the legacy ntfs driver.
--- fs/ntfs3/ntfs_fs.h | 2 ++ fs/ntfs3/super.c | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-)
fs/ntfs3/ntfs_fs.h +2 -0
@@ -1154,4 +1154,6 @@ static inline void le64_sub_cpu(__le64 *var, u64 val) *var = cpu_to_le64(le64_to_cpu(*var) - val); } +bool is_legacy_ntfs (struct super_block *sb); +#endif /* _LINUX_NTFS3_NTFS_FS_H */
fs/ntfs3/super.c +30 -4
@@ -408,6 +408,12 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)struct ntfs_mount_options *new_opts = fc->fs_private;int ro_rw; +/* If ntfs3 is used as legacy ntfs enforce read-only mode. */ +if (is_legacy_ntfs (sb)) { + fc->sb_flags |=SB_RDONLY ; + goto out; + } + ro_rw =sb_rdonly (sb) && !(fc->sb_flags &SB_RDONLY );if (ro_rw && (sbi->flags &NTFS_FLAGS_NEED_REPLAY )) { errorf(fc,
@@ -427,8 +433,6 @@ static int ntfs_fs_reconfigure(struct fs_context *fc) fc, "ntfs3: Cannot use different iocharset when remounting!"); -sync_filesystem (sb); -if (ro_rw && (sbi->volume.flags &VOLUME_FLAG_DIRTY ) && !new_opts->force) { errorf(fc,
@@ -436,6 +440,8 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)return -EINVAL ; } +out: +sync_filesystem (sb);swap (sbi->options, fc->fs_private);return 0 ;
@@ -1730,7 +1736,7 @@ static const struct fs_context_operations ntfs_context_ops = {* This will called when mount/remount. We will first initialize * options so that if remount we can use just that. */ -static int ntfs_init_fs_context (struct fs_context *fc) +static int __ntfs_init_fs_context (struct fs_context *fc) {struct ntfs_mount_options *opts;struct ntfs_sb_info *sbi;
@@ -1778,6 +1784,11 @@ static int ntfs_init_fs_context(struct fs_context *fc)return -ENOMEM ; } +static int ntfs_init_fs_context (struct fs_context *fc) +{ +return __ntfs_init_fs_context (fc); +} +static void ntfs3_kill_sb (struct super_block *sb) {struct ntfs_sb_info *sbi = sb->s_fs_info;
@@ -1800,10 +1811,20 @@ static struct file_system_type ntfs_fs_type = { };#if IS_ENABLED (CONFIG_NTFS_FS ) +static int ntfs_legacy_init_fs_context (struct fs_context *fc) +{ +int ret; + + ret =__ntfs_init_fs_context (fc); +/* If ntfs3 is used as legacy ntfs enforce read-only mode. */ + fc->sb_flags |=SB_RDONLY ; +return ret; +} +static struct file_system_type ntfs_legacy_fs_type = { .owner =THIS_MODULE , .name ="ntfs" , - .init_fs_context = ntfs_init_fs_context, + .init_fs_context = ntfs_legacy_init_fs_context, .parameters = ntfs_fs_parameters, .kill_sb = ntfs3_kill_sb, .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
@@ -1821,9 +1842,14 @@ static inline void unregister_as_ntfs_legacy(void) {unregister_filesystem (&ntfs_legacy_fs_type); } +bool is_legacy_ntfs (struct super_block *sb) +{ +return sb->s_type == &ntfs_legacy_fs_type; +}#else static inline void register_as_ntfs_legacy (void ) {}static inline void unregister_as_ntfs_legacy (void ) {} +bool is_legacy_ntfs (struct super_block *sb) {return false; }#endif
Signature · 1 line
2.43.0
From 5e646f22f0e9d5268d902dfd33a39154c0b5f578 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Tue, 16 Apr 2024 12:20:50 +0200
Subject: [PATCH 2/2] ntfs3: add legacy ntfs file operations
To ensure that ioctl()s can't be used to circumvent write restrictions.
--- fs/ntfs3/dir.c | 7 +++++++ fs/ntfs3/file.c | 8 ++++++++ fs/ntfs3/inode.c | 20 ++++++++++++++++---- fs/ntfs3/ntfs_fs.h | 2 ++ 4 files changed, 33 insertions(+), 4 deletions(-)
fs/ntfs3/dir.c +7 -0
@@ -616,4 +616,11 @@ const struct file_operations ntfs_dir_operations = { .compat_ioctl = ntfs_compat_ioctl,#endif }; + +const struct file_operations ntfs_legacy_dir_operations = { + .llseek = generic_file_llseek, + .read = generic_read_dir, + .iterate_shared = ntfs_readdir, + .open = ntfs_file_open, +};// clang-format on
fs/ntfs3/file.c +8 -0
@@ -1236,4 +1236,12 @@ const struct file_operations ntfs_file_operations = { .fallocate = ntfs_fallocate, .release = ntfs_file_release, }; + +const struct file_operations ntfs_legacy_file_operations = { + .llseek = generic_file_llseek, + .read_iter = ntfs_file_read_iter, + .splice_read = ntfs_file_splice_read, + .open = ntfs_file_open, + .release = ntfs_file_release, +};// clang-format on
fs/ntfs3/inode.c +16 -4
@@ -440,7 +440,10 @@ static struct inode *ntfs_read_mft(struct inode *inode,* Usually a hard links to directories are disabled. */ inode->i_op = &ntfs_dir_inode_operations; - inode->i_fop = &ntfs_dir_operations; +if (is_legacy_ntfs (inode->i_sb)) + inode->i_fop = &ntfs_legacy_dir_operations; +else + inode->i_fop = &ntfs_dir_operations; ni->i_valid =0 ; }else if (S_ISLNK (mode)) { ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY ;
@@ -450,7 +453,10 @@ static struct inode *ntfs_read_mft(struct inode *inode, }else if (S_ISREG (mode)) { ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY ; inode->i_op = &ntfs_file_inode_operations; - inode->i_fop = &ntfs_file_operations; +if (is_legacy_ntfs (inode->i_sb)) + inode->i_fop = &ntfs_legacy_file_operations; +else + inode->i_fop = &ntfs_file_operations; inode->i_mapping->a_ops =is_compressed (ni) ? &ntfs_aops_cmpr : &ntfs_aops;if (ino !=MFT_REC_MFT )
@@ -1614,7 +1620,10 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,if (S_ISDIR (mode)) { inode->i_op = &ntfs_dir_inode_operations; - inode->i_fop = &ntfs_dir_operations; +if (is_legacy_ntfs (inode->i_sb)) + inode->i_fop = &ntfs_legacy_dir_operations; +else + inode->i_fop = &ntfs_dir_operations; }else if (S_ISLNK (mode)) { inode->i_op = &ntfs_link_inode_operations; inode->i_fop =NULL ;
@@ -1623,7 +1632,10 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,inode_nohighmem (inode); }else if (S_ISREG (mode)) { inode->i_op = &ntfs_file_inode_operations; - inode->i_fop = &ntfs_file_operations; +if (is_legacy_ntfs (inode->i_sb)) + inode->i_fop = &ntfs_legacy_file_operations; +else + inode->i_fop = &ntfs_file_operations; inode->i_mapping->a_ops =is_compressed (ni) ? &ntfs_aops_cmpr : &ntfs_aops;init_rwsem (&ni->file.run_lock);
fs/ntfs3/ntfs_fs.h +2 -0
@@ -493,6 +493,7 @@ struct inode *dir_search_u(struct inode *dir, const struct cpu_str *uni, struct ntfs_fnd *fnd);bool dir_is_empty (struct inode *dir);extern const struct file_operations ntfs_dir_operations; +extern const struct file_operations ntfs_legacy_dir_operations;/* Globals from file.c */ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,
@@ -507,6 +508,7 @@ long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg);extern const struct inode_operations ntfs_special_inode_operations;extern const struct inode_operations ntfs_file_inode_operations;extern const struct file_operations ntfs_file_operations; +extern const struct file_operations ntfs_legacy_file_operations;/* Globals from frecord.c */ void ni_remove_mi (struct ntfs_inode *ni,struct mft_inode *mi);
Signature · 1 line
2.43.0
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 11 lines · Christian Brauner
Quoted 9 lines · Johan Hovold
Ah, right, I forgot about
CONFIG_NTFS_RWas I've never enabled it.Judging from the now removed
Kconfigentry perhaps not that many people did:The only supported operation is overwriting existing files, without changing the file length. No file or directory creation, deletion or renaming is possible.
Quoted 7 lines
Quoted 3 lines
but I guess it still makes my argument above mostly moot.
At least if we disable write support in ntfs3 by default for now...
I think we can disable write support in ntfs3 for now. I've picked up the patch to make ntfs3 serve I sent some time ago that Johan tested now.
Note that I actually meant that write support should be disabled completely in ntfs3 for now.
After this first encounter I have zero confidence in that driver and pushing people towards using it (by removing the old, read-only one) is just gonna result in further corrupted filesystems. At least make sure it can't modify anything by default and mark write-support as experimental and broken or something as that's apparently what it is.
Quoted 4 lines
The only thing left is to disable write support for ntfs3 as legacy ntfs driver for now. I took a stab at this. The following two patches I'm appending _should_ be enough iiuc. Johan, please take a look and please test.
I skimmed them and gave them a quick spin. It seems that not specifying either "ro" or "rw" in fstab now results in a ro mount, but I can still specify "rw" explicitly (in fstab or command line) and end up with:
/dev/nvme0n1p3 on /mnt/windows type ntfs (rw,relatime,uid=0,gid=0,iocharset=iso8859-1)
For obvious reasons, I did not dare listing the root directory or write anything, but it looks like it's not read-only.
Using just my naive temporary hack from yesterday:
fs/ntfs3/super.c +3 -0
@@ -1177,6 +1177,9 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_xattr = ntfs_xattr_handlers; sb->s_d_op = options->nocase ? &ntfs_dentry_ops :NULL ; +ntfs_warn (sb,"ntfs3 driver is broken, mounting read only" ); + sb->s_flags |=SB_RDONLY ; + options->nls =ntfs_load_nls (options->nls_name);if (IS_ERR (options->nls)) { options->nls =NULL ;
seems to prevent also explicit rw mounts (but judging from your patches it is not necessarily sufficient to prevent all modifications).
Johan
Konstantin Komarov
maintainerRe: [PATCH 2/2] ntfs3: remove warning
In reply to Christian BraunerQuoted 17 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Christian Brauner <[email protected]>--- fs/ntfs3/inode.c | 1 - 1 file changed, 1 deletion(-)fs/ntfs3/inode.c +0
-0
fs/ntfs3/inode.c static struct inode *ntfs_read_mft(struct inode *inode, · line 429
Quoted 7 lines
fs/ntfs3/inode.c +0
-1@@ -424,7 +424,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,if (names !=le16_to_cpu (rec->hard_links)) {/* Correct minor error on the fly. Do not mark inode as dirty. */ -ntfs_inode_warn (inode,"Correct links count -> %u." , names); rec->hard_links =cpu_to_le16 (names); ni->mi.dirty = true; }
Hello Christian, all,
The initial and true reason for multiple warnings is the disregard of short (DOS) names when counting hard links.
This patch should fixes this bug:
https://lore.kernel.org/ntfs3/[email protected]/T/#u
There is no longer a need to suppress the message itself.
Re: [PATCH 2/2] ntfs3: remove warning
Quoted 10 lines · Konstantin Komarov
Quoted 3 lines · Christian Brauner
This causes visible changes for users that rely on ntfs3 to serve as an alternative for the legacy ntfs driver. Print statements such as this should probably be made conditional on a debug config option or similar.
The initial and true reason for multiple warnings is the disregard of short (DOS) names when counting hard links.
This patch should fixes this bug:
https://lore.kernel.org/ntfs3/[email protected]/T/#u
As I just replied in that thread, I'm also seeing link counts being reduced from 3 to 1, that is, to not just be decremented by one due to the DOS name bug.
Are you sure there are no further issues here and that the patch is indeed correct?
I did not test the patch, which is white-space damaged, but if it addresses also the remaining warnings then the commit message would need to be updated as well.
Johan