linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option
@ 2022-10-07 12:32 Daniel Pinto
  2022-10-07 12:36 ` [PATCH 1/4] fs/ntfs3: fix hidedotfiles mount option by reversing, behaviour Daniel Pinto
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel Pinto @ 2022-10-07 12:32 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

The current implementation of the hidedotfiles has some problems, namely:
 - there is a bug where enabling it actually disables it and vice versa
 - it only works when creating files, not when moving or renaming them
 - is is not listed in the enabled options list by the mount command
 - its name differs from the equivalent hide_dot_files mount option
   used by NTFS-3G, making it incompatible with it for no reason

This series of patches tries to fix those problems.

Daniel Pinto (4):
  fs/ntfs3: fix hidedotfiles mount option by reversing behaviour
  fs/ntfs3: make hidedotfiles mount option work when renaming files
  fs/ntfs3: add hidedotfiles to the list of enabled mount options
  fs/ntfs3: rename hidedotfiles mount option to hide_dot_files

 fs/ntfs3/frecord.c | 9 +++++++++
 fs/ntfs3/inode.c   | 2 +-
 fs/ntfs3/super.c   | 6 ++++--
 3 files changed, 14 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] fs/ntfs3: fix hidedotfiles mount option by reversing, behaviour
  2022-10-07 12:32 [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option Daniel Pinto
@ 2022-10-07 12:36 ` Daniel Pinto
  2022-10-07 12:38 ` [PATCH 2/4] fs/ntfs3: make hidedotfiles mount option work when renaming files Daniel Pinto
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Pinto @ 2022-10-07 12:36 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

Currently, the hidedotfiles mount option is behaving in the reverse
way of what would be expected: enabling it disables setting the
hidden attribute on files or directories with names starting with a
dot and disabling it enables the setting.

Reverse the behaviour of the hidedotfiles mount option so it matches
what is expected.

Signed-off-by: Daniel Pinto <danielpinto52@gmail.com>
---
 fs/ntfs3/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 1e2c04e48f98..c6fd2afde172 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -359,7 +359,7 @@ static int ntfs_fs_parse_param(struct fs_context *fc,
 		opts->nohidden = result.negated ? 1 : 0;
 		break;
 	case Opt_hide_dot_files:
-		opts->hide_dot_files = result.negated ? 1 : 0;
+		opts->hide_dot_files = result.negated ? 0 : 1;
 		break;
 	case Opt_acl:
 		if (!result.negated)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] fs/ntfs3: make hidedotfiles mount option work when renaming files
  2022-10-07 12:32 [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option Daniel Pinto
  2022-10-07 12:36 ` [PATCH 1/4] fs/ntfs3: fix hidedotfiles mount option by reversing, behaviour Daniel Pinto
@ 2022-10-07 12:38 ` Daniel Pinto
  2022-10-07 12:40 ` [PATCH 3/4] fs/ntfs3: add hidedotfiles to the list of enabled mount options Daniel Pinto
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Pinto @ 2022-10-07 12:38 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

Currently, the hidedotfiles mount option only has an effect when
creating new files. Removing or adding the starting dot when moving
or renaming files does not update the hidden attribute.

Make hidedotfiles also set or unset the hidden attribute when a file
gains or loses its starting dot by being moved or renamed.

Signed-off-by: Daniel Pinto <danielpinto52@gmail.com>
---
 fs/ntfs3/frecord.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 70a80f9412f7..41a20d71562a 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3018,6 +3018,15 @@ int ni_add_name(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
 	struct ATTR_FILE_NAME *de_name = (struct ATTR_FILE_NAME *)(de + 1);
 	u16 de_key_size = le16_to_cpu(de->key_size);
 
+	/* If option "hidedotfiles" then set hidden attribute for dot files. */
+	if (ni->mi.sbi->options->hide_dot_files) {
+		if (de_name->name_len > 0 &&
+		    le16_to_cpu(de_name->name[0]) == '.')
+			ni->std_fa |= FILE_ATTRIBUTE_HIDDEN;
+		else
+			ni->std_fa &= ~FILE_ATTRIBUTE_HIDDEN;
+	}
+
 	mi_get_ref(&ni->mi, &de->ref);
 	mi_get_ref(&dir_ni->mi, &de_name->home);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] fs/ntfs3: add hidedotfiles to the list of enabled mount options
  2022-10-07 12:32 [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option Daniel Pinto
  2022-10-07 12:36 ` [PATCH 1/4] fs/ntfs3: fix hidedotfiles mount option by reversing, behaviour Daniel Pinto
  2022-10-07 12:38 ` [PATCH 2/4] fs/ntfs3: make hidedotfiles mount option work when renaming files Daniel Pinto
@ 2022-10-07 12:40 ` Daniel Pinto
  2022-10-07 12:43 ` [PATCH 4/4] fs/ntfs3: rename hidedotfiles mount option to hide_dot_files Daniel Pinto
       [not found] ` <CAKBF=ps4CUA3crkzUUn8J-0WC-6bGb3Z9PPugzebTajGJ+=rSA@mail.gmail.com>
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Pinto @ 2022-10-07 12:40 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

Currently, the ntfs3 driver does return the hidedotfiles mount
option in the list of enabled mount options. This can confuse
users who may doubt they enabled the option when not seeing in
the list provided by the mount command.

Add hidedotfiles mount option to the list of enabled options
provided by the mount command when it is enabled.

Signed-off-by: Daniel Pinto <danielpinto52@gmail.com>
---
 fs/ntfs3/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index c6fd2afde172..d796541e2a67 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -561,6 +561,8 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root)
 		seq_puts(m, ",showmeta");
 	if (opts->nohidden)
 		seq_puts(m, ",nohidden");
+	if (opts->hide_dot_files)
+		seq_puts(m, ",hidedotfiles");
 	if (opts->force)
 		seq_puts(m, ",force");
 	if (opts->noacsrules)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] fs/ntfs3: rename hidedotfiles mount option to hide_dot_files
  2022-10-07 12:32 [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option Daniel Pinto
                   ` (2 preceding siblings ...)
  2022-10-07 12:40 ` [PATCH 3/4] fs/ntfs3: add hidedotfiles to the list of enabled mount options Daniel Pinto
@ 2022-10-07 12:43 ` Daniel Pinto
       [not found] ` <CAKBF=ps4CUA3crkzUUn8J-0WC-6bGb3Z9PPugzebTajGJ+=rSA@mail.gmail.com>
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Pinto @ 2022-10-07 12:43 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3, linux-fsdevel, linux-kernel

The hidedotfiles mount option provides the same functionality as
the NTFS-3G hide_dot_files mount option. As such, it should be
named the same for compatibility with NTGS-3G.

Rename the hidedotfiles to hide_dot_files for compatibility with
NTFS-3G.

Signed-off-by: Daniel Pinto <danielpinto52@gmail.com>
---
 fs/ntfs3/frecord.c | 2 +-
 fs/ntfs3/inode.c   | 2 +-
 fs/ntfs3/super.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 41a20d71562a..552dbc5b80b1 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3018,7 +3018,7 @@ int ni_add_name(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
 	struct ATTR_FILE_NAME *de_name = (struct ATTR_FILE_NAME *)(de + 1);
 	u16 de_key_size = le16_to_cpu(de->key_size);
 
-	/* If option "hidedotfiles" then set hidden attribute for dot files. */
+	/* If option "hide_dot_files" then set hidden attribute for dot files. */
 	if (ni->mi.sbi->options->hide_dot_files) {
 		if (de_name->name_len > 0 &&
 		    le16_to_cpu(de_name->name[0]) == '.')
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index e9cf00d14733..7ce2bb7646db 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1272,7 +1272,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
 		fa = FILE_ATTRIBUTE_ARCHIVE;
 	}
 
-	/* If option "hidedotfiles" then set hidden attribute for dot files. */
+	/* If option "hide_dot_files" then set hidden attribute for dot files. */
 	if (sbi->options->hide_dot_files && name->name[0] == '.')
 		fa |= FILE_ATTRIBUTE_HIDDEN;
 
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index d796541e2a67..af67756998df 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -268,7 +268,7 @@ static const struct fs_parameter_spec ntfs_fs_parameters[] = {
 	fsparam_flag_no("force",		Opt_force),
 	fsparam_flag_no("sparse",		Opt_sparse),
 	fsparam_flag_no("hidden",		Opt_nohidden),
-	fsparam_flag_no("hidedotfiles",		Opt_hide_dot_files),
+	fsparam_flag_no("hide_dot_files",	Opt_hide_dot_files),
 	fsparam_flag_no("acl",			Opt_acl),
 	fsparam_flag_no("showmeta",		Opt_showmeta),
 	fsparam_flag_no("prealloc",		Opt_prealloc),
@@ -562,7 +562,7 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root)
 	if (opts->nohidden)
 		seq_puts(m, ",nohidden");
 	if (opts->hide_dot_files)
-		seq_puts(m, ",hidedotfiles");
+		seq_puts(m, ",hide_dot_files");
 	if (opts->force)
 		seq_puts(m, ",force");
 	if (opts->noacsrules)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option
       [not found] ` <CAKBF=ps4CUA3crkzUUn8J-0WC-6bGb3Z9PPugzebTajGJ+=rSA@mail.gmail.com>
@ 2022-10-10 11:50   ` Daniel Pinto
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Pinto @ 2022-10-10 11:50 UTC (permalink / raw)
  To: Kari Argillander
  Cc: Konstantin Komarov, ntfs3, linux-fsdevel, Linux Kernel Mailing List

Às 09:08 de 09/10/22, Kari Argillander escreveu:
> On Fri, 7 Oct 2022 at 15:32, Daniel Pinto <danielpinto52@gmail.com> wrote:
>>
>> The current implementation of the hidedotfiles has some problems, namely:
>>  - there is a bug where enabling it actually disables it and vice versa
>>  - it only works when creating files, not when moving or renaming them
>>  - is is not listed in the enabled options list by the mount command
>>  - its name differs from the equivalent hide_dot_files mount option
>>    used by NTFS-3G, making it incompatible with it for no reason
>>
>> This series of patches tries to fix those problems.
> 
> While you are fixing this can you also make patch to add documentation
> for this mount option. I also think we really should not make new mount
> option names so I would vote hide_dot_files name as you did. We still have
> time for this change as this is not yet in upstream.
> 

I have submitted a v2 of the patch which includes a commit with the
documentation.

>> Daniel Pinto (4):
>>   fs/ntfs3: fix hidedotfiles mount option by reversing behaviour
>>   fs/ntfs3: make hidedotfiles mount option work when renaming files
>>   fs/ntfs3: add hidedotfiles to the list of enabled mount options
>>   fs/ntfs3: rename hidedotfiles mount option to hide_dot_files
>>
>>  fs/ntfs3/frecord.c | 9 +++++++++
>>  fs/ntfs3/inode.c   | 2 +-
>>  fs/ntfs3/super.c   | 6 ++++--
>>  3 files changed, 14 insertions(+), 3 deletions(-)
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-10 11:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 12:32 [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option Daniel Pinto
2022-10-07 12:36 ` [PATCH 1/4] fs/ntfs3: fix hidedotfiles mount option by reversing, behaviour Daniel Pinto
2022-10-07 12:38 ` [PATCH 2/4] fs/ntfs3: make hidedotfiles mount option work when renaming files Daniel Pinto
2022-10-07 12:40 ` [PATCH 3/4] fs/ntfs3: add hidedotfiles to the list of enabled mount options Daniel Pinto
2022-10-07 12:43 ` [PATCH 4/4] fs/ntfs3: rename hidedotfiles mount option to hide_dot_files Daniel Pinto
     [not found] ` <CAKBF=ps4CUA3crkzUUn8J-0WC-6bGb3Z9PPugzebTajGJ+=rSA@mail.gmail.com>
2022-10-10 11:50   ` [PATCH 0/4] fs/ntfs3: Fix and rename hidedotfiles mount option Daniel Pinto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).