All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix up casefolding sysfs entries for F2FS
@ 2021-06-03  9:50 ` Daniel Rosenberg via Linux-f2fs-devel
  0 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg @ 2021-06-03  9:50 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, Daniel Rosenberg

These correct displaying support for casefolding only when that capability
is present, and advertise if encryption and casefolding are supported
together. Casefolding requires CONFIG_UNICODE, and casefolding with
encryption wasn't supported until commit 7ad08a58bf67
("f2fs: Handle casefolding with Encryption")

Changes for v2: Added comments to double #endif's, added Fixes and Cc tags

Daniel Rosenberg (2):
  f2fs: Show casefolding support only when supported
  f2fs: Advertise encrypted casefolding in sysfs

 fs/f2fs/sysfs.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.32.0.rc0.204.g9fa02ecfa5-goog


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

* [f2fs-dev] [PATCH v2 0/2] Fix up casefolding sysfs entries for F2FS
@ 2021-06-03  9:50 ` Daniel Rosenberg via Linux-f2fs-devel
  0 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg via Linux-f2fs-devel @ 2021-06-03  9:50 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: linux-fsdevel, kernel-team, Gabriel Krisman Bertazi,
	linux-kernel, Daniel Rosenberg

These correct displaying support for casefolding only when that capability
is present, and advertise if encryption and casefolding are supported
together. Casefolding requires CONFIG_UNICODE, and casefolding with
encryption wasn't supported until commit 7ad08a58bf67
("f2fs: Handle casefolding with Encryption")

Changes for v2: Added comments to double #endif's, added Fixes and Cc tags

Daniel Rosenberg (2):
  f2fs: Show casefolding support only when supported
  f2fs: Advertise encrypted casefolding in sysfs

 fs/f2fs/sysfs.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.32.0.rc0.204.g9fa02ecfa5-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [PATCH v2 1/2] f2fs: Show casefolding support only when supported
  2021-06-03  9:50 ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-03  9:50   ` Daniel Rosenberg via Linux-f2fs-devel
  -1 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg @ 2021-06-03  9:50 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, Daniel Rosenberg, stable

The casefolding feature is only supported when CONFIG_UNICODE is set.
This modifies the feature list f2fs presents under sysfs accordingly.

Fixes: 5aba54302a46 ("f2fs: include charset encoding information in the superblock")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Daniel Rosenberg <drosen@google.com>
---
 fs/f2fs/sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index dc71bc968c72..09e3f258eb52 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -720,7 +720,9 @@ F2FS_FEATURE_RO_ATTR(lost_found, FEAT_LOST_FOUND);
 F2FS_FEATURE_RO_ATTR(verity, FEAT_VERITY);
 #endif
 F2FS_FEATURE_RO_ATTR(sb_checksum, FEAT_SB_CHECKSUM);
+#ifdef CONFIG_UNICODE
 F2FS_FEATURE_RO_ATTR(casefold, FEAT_CASEFOLD);
+#endif
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 F2FS_FEATURE_RO_ATTR(compression, FEAT_COMPRESSION);
 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
@@ -829,7 +831,9 @@ static struct attribute *f2fs_feat_attrs[] = {
 	ATTR_LIST(verity),
 #endif
 	ATTR_LIST(sb_checksum),
+#ifdef CONFIG_UNICODE
 	ATTR_LIST(casefold),
+#endif
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 	ATTR_LIST(compression),
 #endif
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog


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

* [f2fs-dev] [PATCH v2 1/2] f2fs: Show casefolding support only when supported
@ 2021-06-03  9:50   ` Daniel Rosenberg via Linux-f2fs-devel
  0 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg via Linux-f2fs-devel @ 2021-06-03  9:50 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: Daniel Rosenberg, Gabriel Krisman Bertazi, linux-kernel, stable,
	linux-fsdevel, kernel-team

The casefolding feature is only supported when CONFIG_UNICODE is set.
This modifies the feature list f2fs presents under sysfs accordingly.

Fixes: 5aba54302a46 ("f2fs: include charset encoding information in the superblock")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Daniel Rosenberg <drosen@google.com>
---
 fs/f2fs/sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index dc71bc968c72..09e3f258eb52 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -720,7 +720,9 @@ F2FS_FEATURE_RO_ATTR(lost_found, FEAT_LOST_FOUND);
 F2FS_FEATURE_RO_ATTR(verity, FEAT_VERITY);
 #endif
 F2FS_FEATURE_RO_ATTR(sb_checksum, FEAT_SB_CHECKSUM);
+#ifdef CONFIG_UNICODE
 F2FS_FEATURE_RO_ATTR(casefold, FEAT_CASEFOLD);
+#endif
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 F2FS_FEATURE_RO_ATTR(compression, FEAT_COMPRESSION);
 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
@@ -829,7 +831,9 @@ static struct attribute *f2fs_feat_attrs[] = {
 	ATTR_LIST(verity),
 #endif
 	ATTR_LIST(sb_checksum),
+#ifdef CONFIG_UNICODE
 	ATTR_LIST(casefold),
+#endif
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 	ATTR_LIST(compression),
 #endif
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03  9:50 ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-03  9:50   ` Daniel Rosenberg via Linux-f2fs-devel
  -1 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg @ 2021-06-03  9:50 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, Daniel Rosenberg, stable

Older kernels don't support encryption with casefolding. This adds
the sysfs entry encrypted_casefold to show support for those combined
features. Support for this feature was originally added by
commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")

Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
Cc: stable@vger.kernel.org # v5.11+
Signed-off-by: Daniel Rosenberg <drosen@google.com>
---
 fs/f2fs/sysfs.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 09e3f258eb52..6604291a3cdf 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
 	if (f2fs_sb_has_compression(sbi))
 		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
 				len ? ", " : "", "compression");
+	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
+		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
+				len ? ", " : "", "encrypted_casefold");
 	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
 				len ? ", " : "", "pin_file");
 	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
@@ -579,6 +582,7 @@ enum feat_id {
 	FEAT_CASEFOLD,
 	FEAT_COMPRESSION,
 	FEAT_TEST_DUMMY_ENCRYPTION_V2,
+	FEAT_ENCRYPTED_CASEFOLD,
 };
 
 static ssize_t f2fs_feature_show(struct f2fs_attr *a,
@@ -600,6 +604,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,
 	case FEAT_CASEFOLD:
 	case FEAT_COMPRESSION:
 	case FEAT_TEST_DUMMY_ENCRYPTION_V2:
+	case FEAT_ENCRYPTED_CASEFOLD:
 		return sprintf(buf, "supported\n");
 	}
 	return 0;
@@ -704,7 +709,10 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);
 #ifdef CONFIG_FS_ENCRYPTION
 F2FS_FEATURE_RO_ATTR(encryption, FEAT_CRYPTO);
 F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2, FEAT_TEST_DUMMY_ENCRYPTION_V2);
-#endif
+#ifdef CONFIG_UNICODE
+F2FS_FEATURE_RO_ATTR(encrypted_casefold, FEAT_ENCRYPTED_CASEFOLD);
+#endif /* CONFIG_UNICODE */
+#endif /* CONFIG_FS_ENCRYPTION */
 #ifdef CONFIG_BLK_DEV_ZONED
 F2FS_FEATURE_RO_ATTR(block_zoned, FEAT_BLKZONED);
 #endif
@@ -815,7 +823,10 @@ static struct attribute *f2fs_feat_attrs[] = {
 #ifdef CONFIG_FS_ENCRYPTION
 	ATTR_LIST(encryption),
 	ATTR_LIST(test_dummy_encryption_v2),
-#endif
+#ifdef CONFIG_UNICODE
+	ATTR_LIST(encrypted_casefold),
+#endif /* CONFIG_UNICODE */
+#endif /* CONFIG_FS_ENCRYPTION */
 #ifdef CONFIG_BLK_DEV_ZONED
 	ATTR_LIST(block_zoned),
 #endif
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog


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

* [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03  9:50   ` Daniel Rosenberg via Linux-f2fs-devel
  0 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg via Linux-f2fs-devel @ 2021-06-03  9:50 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel
  Cc: Daniel Rosenberg, Gabriel Krisman Bertazi, linux-kernel, stable,
	linux-fsdevel, kernel-team

Older kernels don't support encryption with casefolding. This adds
the sysfs entry encrypted_casefold to show support for those combined
features. Support for this feature was originally added by
commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")

Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
Cc: stable@vger.kernel.org # v5.11+
Signed-off-by: Daniel Rosenberg <drosen@google.com>
---
 fs/f2fs/sysfs.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 09e3f258eb52..6604291a3cdf 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
 	if (f2fs_sb_has_compression(sbi))
 		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
 				len ? ", " : "", "compression");
+	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
+		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
+				len ? ", " : "", "encrypted_casefold");
 	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
 				len ? ", " : "", "pin_file");
 	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
@@ -579,6 +582,7 @@ enum feat_id {
 	FEAT_CASEFOLD,
 	FEAT_COMPRESSION,
 	FEAT_TEST_DUMMY_ENCRYPTION_V2,
+	FEAT_ENCRYPTED_CASEFOLD,
 };
 
 static ssize_t f2fs_feature_show(struct f2fs_attr *a,
@@ -600,6 +604,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,
 	case FEAT_CASEFOLD:
 	case FEAT_COMPRESSION:
 	case FEAT_TEST_DUMMY_ENCRYPTION_V2:
+	case FEAT_ENCRYPTED_CASEFOLD:
 		return sprintf(buf, "supported\n");
 	}
 	return 0;
@@ -704,7 +709,10 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);
 #ifdef CONFIG_FS_ENCRYPTION
 F2FS_FEATURE_RO_ATTR(encryption, FEAT_CRYPTO);
 F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2, FEAT_TEST_DUMMY_ENCRYPTION_V2);
-#endif
+#ifdef CONFIG_UNICODE
+F2FS_FEATURE_RO_ATTR(encrypted_casefold, FEAT_ENCRYPTED_CASEFOLD);
+#endif /* CONFIG_UNICODE */
+#endif /* CONFIG_FS_ENCRYPTION */
 #ifdef CONFIG_BLK_DEV_ZONED
 F2FS_FEATURE_RO_ATTR(block_zoned, FEAT_BLKZONED);
 #endif
@@ -815,7 +823,10 @@ static struct attribute *f2fs_feat_attrs[] = {
 #ifdef CONFIG_FS_ENCRYPTION
 	ATTR_LIST(encryption),
 	ATTR_LIST(test_dummy_encryption_v2),
-#endif
+#ifdef CONFIG_UNICODE
+	ATTR_LIST(encrypted_casefold),
+#endif /* CONFIG_UNICODE */
+#endif /* CONFIG_FS_ENCRYPTION */
 #ifdef CONFIG_BLK_DEV_ZONED
 	ATTR_LIST(block_zoned),
 #endif
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-03 10:04     ` Greg KH
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-03 10:04 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 09e3f258eb52..6604291a3cdf 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>  	if (f2fs_sb_has_compression(sbi))
>  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "compression");
> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> +				len ? ", " : "", "encrypted_casefold");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "pin_file");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");

This is a HUGE abuse of sysfs and should not be encouraged and added to.

Please make these "one value per file" and do not keep growing a single
file that has to be parsed otherwise you will break userspace tools.

And I don't see a Documentation/ABI/ entry for this either :(

not good...

greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 10:04     ` Greg KH
  0 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-03 10:04 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: kernel-team, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel, Jaegeuk Kim, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 09e3f258eb52..6604291a3cdf 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>  	if (f2fs_sb_has_compression(sbi))
>  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "compression");
> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> +				len ? ", " : "", "encrypted_casefold");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "pin_file");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");

This is a HUGE abuse of sysfs and should not be encouraged and added to.

Please make these "one value per file" and do not keep growing a single
file that has to be parsed otherwise you will break userspace tools.

And I don't see a Documentation/ABI/ entry for this either :(

not good...

greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 10:04     ` [f2fs-dev] " Greg KH
@ 2021-06-03 15:40       ` Jaegeuk Kim
  -1 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-03 15:40 UTC (permalink / raw)
  To: Greg KH
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On 06/03, Greg KH wrote:
> On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > Older kernels don't support encryption with casefolding. This adds
> > the sysfs entry encrypted_casefold to show support for those combined
> > features. Support for this feature was originally added by
> > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > 
> > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > Cc: stable@vger.kernel.org # v5.11+
> > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > ---
> >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 09e3f258eb52..6604291a3cdf 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> >  	if (f2fs_sb_has_compression(sbi))
> >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "compression");
> > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > +				len ? ", " : "", "encrypted_casefold");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "pin_file");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> 
> This is a HUGE abuse of sysfs and should not be encouraged and added to.

This feature entry was originally added in 2017. Let me try to clean this up
after merging this.

> 
> Please make these "one value per file" and do not keep growing a single
> file that has to be parsed otherwise you will break userspace tools.
> 
> And I don't see a Documentation/ABI/ entry for this either :(

There is in Documentation/ABI/testing/sysfs-fs-f2fs.

> 
> not good...
> 
> greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 15:40       ` Jaegeuk Kim
  0 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-03 15:40 UTC (permalink / raw)
  To: Greg KH
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On 06/03, Greg KH wrote:
> On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > Older kernels don't support encryption with casefolding. This adds
> > the sysfs entry encrypted_casefold to show support for those combined
> > features. Support for this feature was originally added by
> > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > 
> > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > Cc: stable@vger.kernel.org # v5.11+
> > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > ---
> >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 09e3f258eb52..6604291a3cdf 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> >  	if (f2fs_sb_has_compression(sbi))
> >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "compression");
> > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > +				len ? ", " : "", "encrypted_casefold");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "pin_file");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> 
> This is a HUGE abuse of sysfs and should not be encouraged and added to.

This feature entry was originally added in 2017. Let me try to clean this up
after merging this.

> 
> Please make these "one value per file" and do not keep growing a single
> file that has to be parsed otherwise you will break userspace tools.
> 
> And I don't see a Documentation/ABI/ entry for this either :(

There is in Documentation/ABI/testing/sysfs-fs-f2fs.

> 
> not good...
> 
> greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 15:40       ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-03 17:26         ` Greg KH
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-03 17:26 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> On 06/03, Greg KH wrote:
> > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > Older kernels don't support encryption with casefolding. This adds
> > > the sysfs entry encrypted_casefold to show support for those combined
> > > features. Support for this feature was originally added by
> > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > 
> > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > Cc: stable@vger.kernel.org # v5.11+
> > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > ---
> > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > index 09e3f258eb52..6604291a3cdf 100644
> > > --- a/fs/f2fs/sysfs.c
> > > +++ b/fs/f2fs/sysfs.c
> > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > >  	if (f2fs_sb_has_compression(sbi))
> > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "compression");
> > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > +				len ? ", " : "", "encrypted_casefold");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "pin_file");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > 
> > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> 
> This feature entry was originally added in 2017. Let me try to clean this up
> after merging this.

Thank you.

> > Please make these "one value per file" and do not keep growing a single
> > file that has to be parsed otherwise you will break userspace tools.
> > 
> > And I don't see a Documentation/ABI/ entry for this either :(
> 
> There is in Documentation/ABI/testing/sysfs-fs-f2fs.

So this new item was documented in the file before the kernel change was
made?

greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 17:26         ` Greg KH
  0 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-03 17:26 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> On 06/03, Greg KH wrote:
> > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > Older kernels don't support encryption with casefolding. This adds
> > > the sysfs entry encrypted_casefold to show support for those combined
> > > features. Support for this feature was originally added by
> > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > 
> > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > Cc: stable@vger.kernel.org # v5.11+
> > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > ---
> > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > index 09e3f258eb52..6604291a3cdf 100644
> > > --- a/fs/f2fs/sysfs.c
> > > +++ b/fs/f2fs/sysfs.c
> > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > >  	if (f2fs_sb_has_compression(sbi))
> > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "compression");
> > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > +				len ? ", " : "", "encrypted_casefold");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "pin_file");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > 
> > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> 
> This feature entry was originally added in 2017. Let me try to clean this up
> after merging this.

Thank you.

> > Please make these "one value per file" and do not keep growing a single
> > file that has to be parsed otherwise you will break userspace tools.
> > 
> > And I don't see a Documentation/ABI/ entry for this either :(
> 
> There is in Documentation/ABI/testing/sysfs-fs-f2fs.

So this new item was documented in the file before the kernel change was
made?

greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 17:26         ` [f2fs-dev] " Greg KH
@ 2021-06-03 17:53           ` Jaegeuk Kim
  -1 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-03 17:53 UTC (permalink / raw)
  To: Greg KH
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On 06/03, Greg KH wrote:
> On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > On 06/03, Greg KH wrote:
> > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > Older kernels don't support encryption with casefolding. This adds
> > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > features. Support for this feature was originally added by
> > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > 
> > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > Cc: stable@vger.kernel.org # v5.11+
> > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > ---
> > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > --- a/fs/f2fs/sysfs.c
> > > > +++ b/fs/f2fs/sysfs.c
> > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > >  	if (f2fs_sb_has_compression(sbi))
> > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "compression");
> > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > +				len ? ", " : "", "encrypted_casefold");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "pin_file");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > 
> > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > 
> > This feature entry was originally added in 2017. Let me try to clean this up
> > after merging this.
> 
> Thank you.
> 
> > > Please make these "one value per file" and do not keep growing a single
> > > file that has to be parsed otherwise you will break userspace tools.
> > > 
> > > And I don't see a Documentation/ABI/ entry for this either :(
> > 
> > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> 
> So this new item was documented in the file before the kernel change was
> made?

Do we need to describe all the strings in this entry?

203 What:           /sys/fs/f2fs/<disk>/features
204 Date:           July 2017
205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
206 Description:    Shows all enabled features in current device.

> 
> greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 17:53           ` Jaegeuk Kim
  0 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-03 17:53 UTC (permalink / raw)
  To: Greg KH
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On 06/03, Greg KH wrote:
> On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > On 06/03, Greg KH wrote:
> > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > Older kernels don't support encryption with casefolding. This adds
> > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > features. Support for this feature was originally added by
> > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > 
> > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > Cc: stable@vger.kernel.org # v5.11+
> > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > ---
> > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > --- a/fs/f2fs/sysfs.c
> > > > +++ b/fs/f2fs/sysfs.c
> > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > >  	if (f2fs_sb_has_compression(sbi))
> > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "compression");
> > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > +				len ? ", " : "", "encrypted_casefold");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "pin_file");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > 
> > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > 
> > This feature entry was originally added in 2017. Let me try to clean this up
> > after merging this.
> 
> Thank you.
> 
> > > Please make these "one value per file" and do not keep growing a single
> > > file that has to be parsed otherwise you will break userspace tools.
> > > 
> > > And I don't see a Documentation/ABI/ entry for this either :(
> > 
> > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> 
> So this new item was documented in the file before the kernel change was
> made?

Do we need to describe all the strings in this entry?

203 What:           /sys/fs/f2fs/<disk>/features
204 Date:           July 2017
205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
206 Description:    Shows all enabled features in current device.

> 
> greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 17:53           ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-03 18:12             ` Greg KH
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-03 18:12 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 10:53:26AM -0700, Jaegeuk Kim wrote:
> On 06/03, Greg KH wrote:
> > On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > > On 06/03, Greg KH wrote:
> > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > features. Support for this feature was originally added by
> > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > 
> > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > ---
> > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > --- a/fs/f2fs/sysfs.c
> > > > > +++ b/fs/f2fs/sysfs.c
> > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > >  	if (f2fs_sb_has_compression(sbi))
> > > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >  				len ? ", " : "", "compression");
> > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >  				len ? ", " : "", "pin_file");
> > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > 
> > > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > > 
> > > This feature entry was originally added in 2017. Let me try to clean this up
> > > after merging this.
> > 
> > Thank you.
> > 
> > > > Please make these "one value per file" and do not keep growing a single
> > > > file that has to be parsed otherwise you will break userspace tools.
> > > > 
> > > > And I don't see a Documentation/ABI/ entry for this either :(
> > > 
> > > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> > 
> > So this new item was documented in the file before the kernel change was
> > made?
> 
> Do we need to describe all the strings in this entry?
> 
> 203 What:           /sys/fs/f2fs/<disk>/features
> 204 Date:           July 2017
> 205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
> 206 Description:    Shows all enabled features in current device.

Of course!  Especially as this is a total violation of normal sysfs
files, how else are you going to parse the thing?

Why wouldn't you describe the contents?

But again, please obsolete this file and make the features all
individual
files like they should be so that you do not have any parsing problems.

thanks,

greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 18:12             ` Greg KH
  0 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-03 18:12 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 10:53:26AM -0700, Jaegeuk Kim wrote:
> On 06/03, Greg KH wrote:
> > On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > > On 06/03, Greg KH wrote:
> > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > features. Support for this feature was originally added by
> > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > 
> > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > ---
> > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > --- a/fs/f2fs/sysfs.c
> > > > > +++ b/fs/f2fs/sysfs.c
> > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > >  	if (f2fs_sb_has_compression(sbi))
> > > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >  				len ? ", " : "", "compression");
> > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >  				len ? ", " : "", "pin_file");
> > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > 
> > > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > > 
> > > This feature entry was originally added in 2017. Let me try to clean this up
> > > after merging this.
> > 
> > Thank you.
> > 
> > > > Please make these "one value per file" and do not keep growing a single
> > > > file that has to be parsed otherwise you will break userspace tools.
> > > > 
> > > > And I don't see a Documentation/ABI/ entry for this either :(
> > > 
> > > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> > 
> > So this new item was documented in the file before the kernel change was
> > made?
> 
> Do we need to describe all the strings in this entry?
> 
> 203 What:           /sys/fs/f2fs/<disk>/features
> 204 Date:           July 2017
> 205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
> 206 Description:    Shows all enabled features in current device.

Of course!  Especially as this is a total violation of normal sysfs
files, how else are you going to parse the thing?

Why wouldn't you describe the contents?

But again, please obsolete this file and make the features all
individual
files like they should be so that you do not have any parsing problems.

thanks,

greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 1/2] f2fs: Show casefolding support only when supported
  2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-03 18:20     ` Eric Biggers
  -1 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-03 18:20 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 09:50:37AM +0000, Daniel Rosenberg wrote:
> The casefolding feature is only supported when CONFIG_UNICODE is set.
> This modifies the feature list f2fs presents under sysfs accordingly.
> 
> Fixes: 5aba54302a46 ("f2fs: include charset encoding information in the superblock")
> Cc: stable@vger.kernel.org # v5.4+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Eric Biggers <ebiggers@google.com>

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

* Re: [f2fs-dev] [PATCH v2 1/2] f2fs: Show casefolding support only when supported
@ 2021-06-03 18:20     ` Eric Biggers
  0 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-03 18:20 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: kernel-team, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel, Jaegeuk Kim, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 09:50:37AM +0000, Daniel Rosenberg wrote:
> The casefolding feature is only supported when CONFIG_UNICODE is set.
> This modifies the feature list f2fs presents under sysfs accordingly.
> 
> Fixes: 5aba54302a46 ("f2fs: include charset encoding information in the superblock")
> Cc: stable@vger.kernel.org # v5.4+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Eric Biggers <ebiggers@google.com>


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-03 18:26     ` Eric Biggers
  -1 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-03 18:26 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 09e3f258eb52..6604291a3cdf 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>  	if (f2fs_sb_has_compression(sbi))
>  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "compression");
> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> +				len ? ", " : "", "encrypted_casefold");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "pin_file");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> @@ -579,6 +582,7 @@ enum feat_id {
>  	FEAT_CASEFOLD,
>  	FEAT_COMPRESSION,
>  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> +	FEAT_ENCRYPTED_CASEFOLD,
>  };
>  
>  static ssize_t f2fs_feature_show(struct f2fs_attr *a,
> @@ -600,6 +604,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,
>  	case FEAT_CASEFOLD:
>  	case FEAT_COMPRESSION:
>  	case FEAT_TEST_DUMMY_ENCRYPTION_V2:
> +	case FEAT_ENCRYPTED_CASEFOLD:
>  		return sprintf(buf, "supported\n");
>  	}
>  	return 0;
> @@ -704,7 +709,10 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);
>  #ifdef CONFIG_FS_ENCRYPTION
>  F2FS_FEATURE_RO_ATTR(encryption, FEAT_CRYPTO);
>  F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2, FEAT_TEST_DUMMY_ENCRYPTION_V2);
> -#endif
> +#ifdef CONFIG_UNICODE
> +F2FS_FEATURE_RO_ATTR(encrypted_casefold, FEAT_ENCRYPTED_CASEFOLD);
> +#endif /* CONFIG_UNICODE */
> +#endif /* CONFIG_FS_ENCRYPTION */

I had only asked for the #endif comment for CONFIG_FS_ENCRYPTION, since that is
a longer block.  #endif comments aren't helpful for single-line blocks.
See Documentation/process/coding-style.rst:

	At the end of any non-trivial #if or #ifdef block (more than a few lines),
	place a comment after the #endif on the same line, noting the conditional
	expression used.

Anyway, doesn't matter much...

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 18:26     ` Eric Biggers
  0 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-03 18:26 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: kernel-team, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel, Jaegeuk Kim, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 09e3f258eb52..6604291a3cdf 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>  	if (f2fs_sb_has_compression(sbi))
>  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "compression");
> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> +				len ? ", " : "", "encrypted_casefold");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "pin_file");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> @@ -579,6 +582,7 @@ enum feat_id {
>  	FEAT_CASEFOLD,
>  	FEAT_COMPRESSION,
>  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> +	FEAT_ENCRYPTED_CASEFOLD,
>  };
>  
>  static ssize_t f2fs_feature_show(struct f2fs_attr *a,
> @@ -600,6 +604,7 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a,
>  	case FEAT_CASEFOLD:
>  	case FEAT_COMPRESSION:
>  	case FEAT_TEST_DUMMY_ENCRYPTION_V2:
> +	case FEAT_ENCRYPTED_CASEFOLD:
>  		return sprintf(buf, "supported\n");
>  	}
>  	return 0;
> @@ -704,7 +709,10 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);
>  #ifdef CONFIG_FS_ENCRYPTION
>  F2FS_FEATURE_RO_ATTR(encryption, FEAT_CRYPTO);
>  F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2, FEAT_TEST_DUMMY_ENCRYPTION_V2);
> -#endif
> +#ifdef CONFIG_UNICODE
> +F2FS_FEATURE_RO_ATTR(encrypted_casefold, FEAT_ENCRYPTED_CASEFOLD);
> +#endif /* CONFIG_UNICODE */
> +#endif /* CONFIG_FS_ENCRYPTION */

I had only asked for the #endif comment for CONFIG_FS_ENCRYPTION, since that is
a longer block.  #endif comments aren't helpful for single-line blocks.
See Documentation/process/coding-style.rst:

	At the end of any non-trivial #if or #ifdef block (more than a few lines),
	place a comment after the #endif on the same line, noting the conditional
	expression used.

Anyway, doesn't matter much...

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 18:12             ` [f2fs-dev] " Greg KH
@ 2021-06-03 19:20               ` Jaegeuk Kim
  -1 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-03 19:20 UTC (permalink / raw)
  To: Greg KH
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On 06/03, Greg KH wrote:
> On Thu, Jun 03, 2021 at 10:53:26AM -0700, Jaegeuk Kim wrote:
> > On 06/03, Greg KH wrote:
> > > On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > > > On 06/03, Greg KH wrote:
> > > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > > features. Support for this feature was originally added by
> > > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > 
> > > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > > ---
> > > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > > --- a/fs/f2fs/sysfs.c
> > > > > > +++ b/fs/f2fs/sysfs.c
> > > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > > >  	if (f2fs_sb_has_compression(sbi))
> > > > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "compression");
> > > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "pin_file");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > > 
> > > > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > > > 
> > > > This feature entry was originally added in 2017. Let me try to clean this up
> > > > after merging this.
> > > 
> > > Thank you.
> > > 
> > > > > Please make these "one value per file" and do not keep growing a single
> > > > > file that has to be parsed otherwise you will break userspace tools.
> > > > > 
> > > > > And I don't see a Documentation/ABI/ entry for this either :(
> > > > 
> > > > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> > > 
> > > So this new item was documented in the file before the kernel change was
> > > made?
> > 
> > Do we need to describe all the strings in this entry?
> > 
> > 203 What:           /sys/fs/f2fs/<disk>/features
> > 204 Date:           July 2017
> > 205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
> > 206 Description:    Shows all enabled features in current device.
> 
> Of course!  Especially as this is a total violation of normal sysfs
> files, how else are you going to parse the thing?
> 
> Why wouldn't you describe the contents?

Because I was lazy. :P

Daniel, let me clean up all together in another patch. :)

> 
> But again, please obsolete this file and make the features all
> individual
> files like they should be so that you do not have any parsing problems.

Yup, will do.

> 
> thanks,
> 
> greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 19:20               ` Jaegeuk Kim
  0 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-03 19:20 UTC (permalink / raw)
  To: Greg KH
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On 06/03, Greg KH wrote:
> On Thu, Jun 03, 2021 at 10:53:26AM -0700, Jaegeuk Kim wrote:
> > On 06/03, Greg KH wrote:
> > > On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > > > On 06/03, Greg KH wrote:
> > > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > > features. Support for this feature was originally added by
> > > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > 
> > > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > > ---
> > > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > > --- a/fs/f2fs/sysfs.c
> > > > > > +++ b/fs/f2fs/sysfs.c
> > > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > > >  	if (f2fs_sb_has_compression(sbi))
> > > > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "compression");
> > > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "pin_file");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > > 
> > > > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > > > 
> > > > This feature entry was originally added in 2017. Let me try to clean this up
> > > > after merging this.
> > > 
> > > Thank you.
> > > 
> > > > > Please make these "one value per file" and do not keep growing a single
> > > > > file that has to be parsed otherwise you will break userspace tools.
> > > > > 
> > > > > And I don't see a Documentation/ABI/ entry for this either :(
> > > > 
> > > > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> > > 
> > > So this new item was documented in the file before the kernel change was
> > > made?
> > 
> > Do we need to describe all the strings in this entry?
> > 
> > 203 What:           /sys/fs/f2fs/<disk>/features
> > 204 Date:           July 2017
> > 205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
> > 206 Description:    Shows all enabled features in current device.
> 
> Of course!  Especially as this is a total violation of normal sysfs
> files, how else are you going to parse the thing?
> 
> Why wouldn't you describe the contents?

Because I was lazy. :P

Daniel, let me clean up all together in another patch. :)

> 
> But again, please obsolete this file and make the features all
> individual
> files like they should be so that you do not have any parsing problems.

Yup, will do.

> 
> thanks,
> 
> greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* RE: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 18:12             ` [f2fs-dev] " Greg KH
@ 2021-06-03 20:54               ` David Laight
  -1 siblings, 0 replies; 48+ messages in thread
From: David Laight @ 2021-06-03 20:54 UTC (permalink / raw)
  To: 'Greg KH', Jaegeuk Kim
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

From: Greg KH
> Sent: 03 June 2021 19:13
> 
> On Thu, Jun 03, 2021 at 10:53:26AM -0700, Jaegeuk Kim wrote:
> > On 06/03, Greg KH wrote:
> > > On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > > > On 06/03, Greg KH wrote:
> > > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > > features. Support for this feature was originally added by
> > > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > >
> > > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > > ---
> > > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > >
> > > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > > --- a/fs/f2fs/sysfs.c
> > > > > > +++ b/fs/f2fs/sysfs.c
> > > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > > >  	if (f2fs_sb_has_compression(sbi))
> > > > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "compression");
> > > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "pin_file");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > >
> > > > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > > >
> > > > This feature entry was originally added in 2017. Let me try to clean this up
> > > > after merging this.
> > >
> > > Thank you.
> > >
> > > > > Please make these "one value per file" and do not keep growing a single
> > > > > file that has to be parsed otherwise you will break userspace tools.
> > > > >
> > > > > And I don't see a Documentation/ABI/ entry for this either :(
> > > >
> > > > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> > >
> > > So this new item was documented in the file before the kernel change was
> > > made?
> >
> > Do we need to describe all the strings in this entry?
> >
> > 203 What:           /sys/fs/f2fs/<disk>/features
> > 204 Date:           July 2017
> > 205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
> > 206 Description:    Shows all enabled features in current device.
> 
> Of course!  Especially as this is a total violation of normal sysfs
> files, how else are you going to parse the thing?
> 
> Why wouldn't you describe the contents?
> 
> But again, please obsolete this file and make the features all
> individual
> files like they should be so that you do not have any parsing problems.

My 2c:

Isn't this a list of fixed strings - rather than a list of values.
So parsing isn't that difficult.
Although it would be more sensible to add new ones at the end.

If they were in separate files you'd need to start reading the
directory to find which names were supported (or known) and then
read the file itself to see if it was actually in use.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 20:54               ` David Laight
  0 siblings, 0 replies; 48+ messages in thread
From: David Laight @ 2021-06-03 20:54 UTC (permalink / raw)
  To: 'Greg KH', Jaegeuk Kim
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

From: Greg KH
> Sent: 03 June 2021 19:13
> 
> On Thu, Jun 03, 2021 at 10:53:26AM -0700, Jaegeuk Kim wrote:
> > On 06/03, Greg KH wrote:
> > > On Thu, Jun 03, 2021 at 08:40:24AM -0700, Jaegeuk Kim wrote:
> > > > On 06/03, Greg KH wrote:
> > > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > > features. Support for this feature was originally added by
> > > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > >
> > > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > > ---
> > > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > >
> > > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > > --- a/fs/f2fs/sysfs.c
> > > > > > +++ b/fs/f2fs/sysfs.c
> > > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > > >  	if (f2fs_sb_has_compression(sbi))
> > > > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "compression");
> > > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >  				len ? ", " : "", "pin_file");
> > > > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > >
> > > > > This is a HUGE abuse of sysfs and should not be encouraged and added to.
> > > >
> > > > This feature entry was originally added in 2017. Let me try to clean this up
> > > > after merging this.
> > >
> > > Thank you.
> > >
> > > > > Please make these "one value per file" and do not keep growing a single
> > > > > file that has to be parsed otherwise you will break userspace tools.
> > > > >
> > > > > And I don't see a Documentation/ABI/ entry for this either :(
> > > >
> > > > There is in Documentation/ABI/testing/sysfs-fs-f2fs.
> > >
> > > So this new item was documented in the file before the kernel change was
> > > made?
> >
> > Do we need to describe all the strings in this entry?
> >
> > 203 What:           /sys/fs/f2fs/<disk>/features
> > 204 Date:           July 2017
> > 205 Contact:        "Jaegeuk Kim" <jaegeuk@kernel.org>
> > 206 Description:    Shows all enabled features in current device.
> 
> Of course!  Especially as this is a total violation of normal sysfs
> files, how else are you going to parse the thing?
> 
> Why wouldn't you describe the contents?
> 
> But again, please obsolete this file and make the features all
> individual
> files like they should be so that you do not have any parsing problems.

My 2c:

Isn't this a list of fixed strings - rather than a list of values.
So parsing isn't that difficult.
Although it would be more sensible to add new ones at the end.

If they were in separate files you'd need to start reading the
directory to find which names were supported (or known) and then
read the file itself to see if it was actually in use.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-03 23:21     ` Eric Biggers
  -1 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-03 23:21 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 09e3f258eb52..6604291a3cdf 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>  	if (f2fs_sb_has_compression(sbi))
>  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "compression");
> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> +				len ? ", " : "", "encrypted_casefold");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "pin_file");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> @@ -579,6 +582,7 @@ enum feat_id {
>  	FEAT_CASEFOLD,
>  	FEAT_COMPRESSION,
>  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> +	FEAT_ENCRYPTED_CASEFOLD,
>  };

Actually looking at it more closely, this patch is wrong.

It only makes sense to declare "encrypted_casefold" as a feature of the
filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.

It does *not* make sense to declare it as a feature of a particular filesystem
instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
filesystem instance having both the encryption and casefold features enabled.

Can we add /sys/fs/f2fs/features/encrypted_casefold only?

- Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-03 23:21     ` Eric Biggers
  0 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-03 23:21 UTC (permalink / raw)
  To: Daniel Rosenberg
  Cc: kernel-team, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel, Jaegeuk Kim, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  fs/f2fs/sysfs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 09e3f258eb52..6604291a3cdf 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>  	if (f2fs_sb_has_compression(sbi))
>  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "compression");
> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> +				len ? ", " : "", "encrypted_casefold");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>  				len ? ", " : "", "pin_file");
>  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> @@ -579,6 +582,7 @@ enum feat_id {
>  	FEAT_CASEFOLD,
>  	FEAT_COMPRESSION,
>  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> +	FEAT_ENCRYPTED_CASEFOLD,
>  };

Actually looking at it more closely, this patch is wrong.

It only makes sense to declare "encrypted_casefold" as a feature of the
filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.

It does *not* make sense to declare it as a feature of a particular filesystem
instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
filesystem instance having both the encryption and casefold features enabled.

Can we add /sys/fs/f2fs/features/encrypted_casefold only?

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03 23:21     ` [f2fs-dev] " Eric Biggers
@ 2021-06-04  4:45       ` Jaegeuk Kim
  -1 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-04  4:45 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On 06/03, Eric Biggers wrote:
> On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > Older kernels don't support encryption with casefolding. This adds
> > the sysfs entry encrypted_casefold to show support for those combined
> > features. Support for this feature was originally added by
> > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > 
> > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > Cc: stable@vger.kernel.org # v5.11+
> > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > ---
> >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 09e3f258eb52..6604291a3cdf 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> >  	if (f2fs_sb_has_compression(sbi))
> >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "compression");
> > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > +				len ? ", " : "", "encrypted_casefold");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "pin_file");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > @@ -579,6 +582,7 @@ enum feat_id {
> >  	FEAT_CASEFOLD,
> >  	FEAT_COMPRESSION,
> >  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > +	FEAT_ENCRYPTED_CASEFOLD,
> >  };
> 
> Actually looking at it more closely, this patch is wrong.
> 
> It only makes sense to declare "encrypted_casefold" as a feature of the
> filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> 
> It does *not* make sense to declare it as a feature of a particular filesystem
> instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> filesystem instance having both the encryption and casefold features enabled.
> 
> Can we add /sys/fs/f2fs/features/encrypted_casefold only?

wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.

> 
> - Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04  4:45       ` Jaegeuk Kim
  0 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-04  4:45 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On 06/03, Eric Biggers wrote:
> On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > Older kernels don't support encryption with casefolding. This adds
> > the sysfs entry encrypted_casefold to show support for those combined
> > features. Support for this feature was originally added by
> > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > 
> > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > Cc: stable@vger.kernel.org # v5.11+
> > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > ---
> >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 09e3f258eb52..6604291a3cdf 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> >  	if (f2fs_sb_has_compression(sbi))
> >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "compression");
> > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > +				len ? ", " : "", "encrypted_casefold");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> >  				len ? ", " : "", "pin_file");
> >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > @@ -579,6 +582,7 @@ enum feat_id {
> >  	FEAT_CASEFOLD,
> >  	FEAT_COMPRESSION,
> >  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > +	FEAT_ENCRYPTED_CASEFOLD,
> >  };
> 
> Actually looking at it more closely, this patch is wrong.
> 
> It only makes sense to declare "encrypted_casefold" as a feature of the
> filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> 
> It does *not* make sense to declare it as a feature of a particular filesystem
> instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> filesystem instance having both the encryption and casefold features enabled.
> 
> Can we add /sys/fs/f2fs/features/encrypted_casefold only?

wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.

> 
> - Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  4:45       ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-04  5:01         ` Eric Biggers
  -1 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-04  5:01 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> On 06/03, Eric Biggers wrote:
> > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > Older kernels don't support encryption with casefolding. This adds
> > > the sysfs entry encrypted_casefold to show support for those combined
> > > features. Support for this feature was originally added by
> > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > 
> > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > Cc: stable@vger.kernel.org # v5.11+
> > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > ---
> > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > index 09e3f258eb52..6604291a3cdf 100644
> > > --- a/fs/f2fs/sysfs.c
> > > +++ b/fs/f2fs/sysfs.c
> > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > >  	if (f2fs_sb_has_compression(sbi))
> > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "compression");
> > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > +				len ? ", " : "", "encrypted_casefold");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "pin_file");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > @@ -579,6 +582,7 @@ enum feat_id {
> > >  	FEAT_CASEFOLD,
> > >  	FEAT_COMPRESSION,
> > >  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > +	FEAT_ENCRYPTED_CASEFOLD,
> > >  };
> > 
> > Actually looking at it more closely, this patch is wrong.
> > 
> > It only makes sense to declare "encrypted_casefold" as a feature of the
> > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > 
> > It does *not* make sense to declare it as a feature of a particular filesystem
> > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > filesystem instance having both the encryption and casefold features enabled.
> > 
> > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> 
> wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> 

Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
means encrypt && casefold.  There is no encrypted_casefold flag on-disk.

- Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04  5:01         ` Eric Biggers
  0 siblings, 0 replies; 48+ messages in thread
From: Eric Biggers @ 2021-06-04  5:01 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> On 06/03, Eric Biggers wrote:
> > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > Older kernels don't support encryption with casefolding. This adds
> > > the sysfs entry encrypted_casefold to show support for those combined
> > > features. Support for this feature was originally added by
> > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > 
> > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > Cc: stable@vger.kernel.org # v5.11+
> > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > ---
> > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > index 09e3f258eb52..6604291a3cdf 100644
> > > --- a/fs/f2fs/sysfs.c
> > > +++ b/fs/f2fs/sysfs.c
> > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > >  	if (f2fs_sb_has_compression(sbi))
> > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "compression");
> > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > +				len ? ", " : "", "encrypted_casefold");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "pin_file");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > @@ -579,6 +582,7 @@ enum feat_id {
> > >  	FEAT_CASEFOLD,
> > >  	FEAT_COMPRESSION,
> > >  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > +	FEAT_ENCRYPTED_CASEFOLD,
> > >  };
> > 
> > Actually looking at it more closely, this patch is wrong.
> > 
> > It only makes sense to declare "encrypted_casefold" as a feature of the
> > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > 
> > It does *not* make sense to declare it as a feature of a particular filesystem
> > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > filesystem instance having both the encryption and casefold features enabled.
> > 
> > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> 
> wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> 

Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
means encrypt && casefold.  There is no encrypted_casefold flag on-disk.

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  5:01         ` [f2fs-dev] " Eric Biggers
@ 2021-06-04  5:38           ` Jaegeuk Kim
  -1 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-04  5:38 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On 06/03, Eric Biggers wrote:
> On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> > On 06/03, Eric Biggers wrote:
> > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > Older kernels don't support encryption with casefolding. This adds
> > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > features. Support for this feature was originally added by
> > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > 
> > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > Cc: stable@vger.kernel.org # v5.11+
> > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > ---
> > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > --- a/fs/f2fs/sysfs.c
> > > > +++ b/fs/f2fs/sysfs.c
> > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > >  	if (f2fs_sb_has_compression(sbi))
> > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "compression");
> > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > +				len ? ", " : "", "encrypted_casefold");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "pin_file");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > @@ -579,6 +582,7 @@ enum feat_id {
> > > >  	FEAT_CASEFOLD,
> > > >  	FEAT_COMPRESSION,
> > > >  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > > +	FEAT_ENCRYPTED_CASEFOLD,
> > > >  };
> > > 
> > > Actually looking at it more closely, this patch is wrong.
> > > 
> > > It only makes sense to declare "encrypted_casefold" as a feature of the
> > > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > > 
> > > It does *not* make sense to declare it as a feature of a particular filesystem
> > > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > > filesystem instance having both the encryption and casefold features enabled.
> > > 
> > > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> > 
> > wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> > CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> > OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> > on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> > 
> 
> Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> means encrypt && casefold.  There is no encrypted_casefold flag on-disk.

I prefer to keep encrypted_casefold likewise kernel feature, which is more
intuitive to users.

> 
> - Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04  5:38           ` Jaegeuk Kim
  0 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-04  5:38 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

On 06/03, Eric Biggers wrote:
> On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> > On 06/03, Eric Biggers wrote:
> > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > Older kernels don't support encryption with casefolding. This adds
> > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > features. Support for this feature was originally added by
> > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > 
> > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > Cc: stable@vger.kernel.org # v5.11+
> > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > ---
> > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > --- a/fs/f2fs/sysfs.c
> > > > +++ b/fs/f2fs/sysfs.c
> > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > >  	if (f2fs_sb_has_compression(sbi))
> > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "compression");
> > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > +				len ? ", " : "", "encrypted_casefold");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "pin_file");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > @@ -579,6 +582,7 @@ enum feat_id {
> > > >  	FEAT_CASEFOLD,
> > > >  	FEAT_COMPRESSION,
> > > >  	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > > +	FEAT_ENCRYPTED_CASEFOLD,
> > > >  };
> > > 
> > > Actually looking at it more closely, this patch is wrong.
> > > 
> > > It only makes sense to declare "encrypted_casefold" as a feature of the
> > > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > > 
> > > It does *not* make sense to declare it as a feature of a particular filesystem
> > > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > > filesystem instance having both the encryption and casefold features enabled.
> > > 
> > > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> > 
> > wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> > CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> > OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> > on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> > 
> 
> Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> means encrypt && casefold.  There is no encrypted_casefold flag on-disk.

I prefer to keep encrypted_casefold likewise kernel feature, which is more
intuitive to users.

> 
> - Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  5:38           ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-04  5:54             ` Daniel Rosenberg via Linux-f2fs-devel
  -1 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg @ 2021-06-04  5:54 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Eric Biggers, Chao Yu, linux-f2fs-devel,
	Linux Kernel Mailing List, linux-fsdevel,
	Gabriel Krisman Bertazi, kernel-team, stable

On Thu, Jun 3, 2021 at 10:38 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> On 06/03, Eric Biggers wrote:
> > On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> > > On 06/03, Eric Biggers wrote:
> > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > features. Support for this feature was originally added by
> > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > >
> > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > ---
> > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > --- a/fs/f2fs/sysfs.c
> > > > > +++ b/fs/f2fs/sysfs.c
> > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > >         if (f2fs_sb_has_compression(sbi))
> > > > >                 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >                                 len ? ", " : "", "compression");
> > > > > +       if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > +               len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > +                               len ? ", " : "", "encrypted_casefold");
> > > > >         len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >                                 len ? ", " : "", "pin_file");
> > > > >         len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > > @@ -579,6 +582,7 @@ enum feat_id {
> > > > >         FEAT_CASEFOLD,
> > > > >         FEAT_COMPRESSION,
> > > > >         FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > > > +       FEAT_ENCRYPTED_CASEFOLD,
> > > > >  };
> > > >
> > > > Actually looking at it more closely, this patch is wrong.
> > > >
> > > > It only makes sense to declare "encrypted_casefold" as a feature of the
> > > > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > > >
> > > > It does *not* make sense to declare it as a feature of a particular filesystem
> > > > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > > > filesystem instance having both the encryption and casefold features enabled.
> > > >
> > > > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> > >
> > > wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> > > CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> > > OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> > > on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> > >
> >
> > Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> > means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
>
> I prefer to keep encrypted_casefold likewise kernel feature, which is more
> intuitive to users.
>
> >
> > - Eric

When I added the feature_show one, I had been mistakenly thinking of
cases where both were enabled in the filesystem, but not on the same
directory. That case doesn't actually exist, since before the patch to
support both on the same directory, we just wouldn't mount a
filesystem that reported both as on. I think it'd make more sense
without that part. The kernel feature one definitely makes sense,
since previously the kernel could support either, but not both.

-Daniel

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04  5:54             ` Daniel Rosenberg via Linux-f2fs-devel
  0 siblings, 0 replies; 48+ messages in thread
From: Daniel Rosenberg via Linux-f2fs-devel @ 2021-06-04  5:54 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: kernel-team, Linux Kernel Mailing List, stable, linux-f2fs-devel,
	Eric Biggers, linux-fsdevel, Gabriel Krisman Bertazi

On Thu, Jun 3, 2021 at 10:38 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> On 06/03, Eric Biggers wrote:
> > On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> > > On 06/03, Eric Biggers wrote:
> > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > features. Support for this feature was originally added by
> > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > >
> > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > ---
> > > > >  fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > --- a/fs/f2fs/sysfs.c
> > > > > +++ b/fs/f2fs/sysfs.c
> > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > >         if (f2fs_sb_has_compression(sbi))
> > > > >                 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >                                 len ? ", " : "", "compression");
> > > > > +       if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > +               len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > +                               len ? ", " : "", "encrypted_casefold");
> > > > >         len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > >                                 len ? ", " : "", "pin_file");
> > > > >         len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > > @@ -579,6 +582,7 @@ enum feat_id {
> > > > >         FEAT_CASEFOLD,
> > > > >         FEAT_COMPRESSION,
> > > > >         FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > > > +       FEAT_ENCRYPTED_CASEFOLD,
> > > > >  };
> > > >
> > > > Actually looking at it more closely, this patch is wrong.
> > > >
> > > > It only makes sense to declare "encrypted_casefold" as a feature of the
> > > > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > > >
> > > > It does *not* make sense to declare it as a feature of a particular filesystem
> > > > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > > > filesystem instance having both the encryption and casefold features enabled.
> > > >
> > > > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> > >
> > > wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> > > CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> > > OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> > > on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> > >
> >
> > Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> > means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
>
> I prefer to keep encrypted_casefold likewise kernel feature, which is more
> intuitive to users.
>
> >
> > - Eric

When I added the feature_show one, I had been mistakenly thinking of
cases where both were enabled in the filesystem, but not on the same
directory. That case doesn't actually exist, since before the patch to
support both on the same directory, we just wouldn't mount a
filesystem that reported both as on. I think it'd make more sense
without that part. The kernel feature one definitely makes sense,
since previously the kernel could support either, but not both.

-Daniel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* RE: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  4:45       ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-04  8:27         ` David Laight
  -1 siblings, 0 replies; 48+ messages in thread
From: David Laight @ 2021-06-04  8:27 UTC (permalink / raw)
  To: 'Jaegeuk Kim', Eric Biggers
  Cc: Daniel Rosenberg, Chao Yu, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

From: Jaegeuk Kim
> Sent: 04 June 2021 05:45
...
> > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > >  	if (f2fs_sb_has_compression(sbi))
> > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "compression");
> > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > +				len ? ", " : "", "encrypted_casefold");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "pin_file");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");

Looking at that pattern, why don't you just append "tag, "
each time and then replace the final ", " with "\n" at the end.

Although if I wanted to quickly parse that in (say) a shell
script I wouldn't really want the ",".
OTOH it is too late to change that.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04  8:27         ` David Laight
  0 siblings, 0 replies; 48+ messages in thread
From: David Laight @ 2021-06-04  8:27 UTC (permalink / raw)
  To: 'Jaegeuk Kim', Eric Biggers
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, Gabriel Krisman Bertazi

From: Jaegeuk Kim
> Sent: 04 June 2021 05:45
...
> > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > >  	if (f2fs_sb_has_compression(sbi))
> > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "compression");
> > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > +				len ? ", " : "", "encrypted_casefold");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > >  				len ? ", " : "", "pin_file");
> > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");

Looking at that pattern, why don't you just append "tag, "
each time and then replace the final ", " with "\n" at the end.

Although if I wanted to quickly parse that in (say) a shell
script I wouldn't really want the ",".
OTOH it is too late to change that.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  8:27         ` [f2fs-dev] " David Laight
@ 2021-06-04  8:33           ` Greg KH
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-04  8:33 UTC (permalink / raw)
  To: David Laight
  Cc: 'Jaegeuk Kim',
	Eric Biggers, Daniel Rosenberg, Chao Yu, linux-f2fs-devel,
	linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, stable

On Fri, Jun 04, 2021 at 08:27:32AM +0000, David Laight wrote:
> From: Jaegeuk Kim
> > Sent: 04 June 2021 05:45
> ...
> > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > >  	if (f2fs_sb_has_compression(sbi))
> > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "compression");
> > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > +				len ? ", " : "", "encrypted_casefold");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "pin_file");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> 
> Looking at that pattern, why don't you just append "tag, "
> each time and then replace the final ", " with "\n" at the end.

Again PLEASE NO!

This is not how sysfs is supposed to work and do not perpetuate this
mess in any way.

greg k-h

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04  8:33           ` Greg KH
  0 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2021-06-04  8:33 UTC (permalink / raw)
  To: David Laight
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, Eric Biggers, linux-fsdevel,
	'Jaegeuk Kim',
	Gabriel Krisman Bertazi

On Fri, Jun 04, 2021 at 08:27:32AM +0000, David Laight wrote:
> From: Jaegeuk Kim
> > Sent: 04 June 2021 05:45
> ...
> > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > >  	if (f2fs_sb_has_compression(sbi))
> > > >  		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "compression");
> > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > +				len ? ", " : "", "encrypted_casefold");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > >  				len ? ", " : "", "pin_file");
> > > >  	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> 
> Looking at that pattern, why don't you just append "tag, "
> each time and then replace the final ", " with "\n" at the end.

Again PLEASE NO!

This is not how sysfs is supposed to work and do not perpetuate this
mess in any way.

greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  5:38           ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-04 18:58             ` Theodore Ts'o
  -1 siblings, 0 replies; 48+ messages in thread
From: Theodore Ts'o @ 2021-06-04 18:58 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Eric Biggers, Daniel Rosenberg, Chao Yu, linux-f2fs-devel,
	linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, stable

On Thu, Jun 03, 2021 at 10:38:48PM -0700, Jaegeuk Kim wrote:
 > > Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> > means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
> 
> I prefer to keep encrypted_casefold likewise kernel feature, which is more
> intuitive to users.

At least for ext4, there are kernel vesions which support encryption
and casefold *separetely*, but which do not support the file systems
that have encryption and casefold enabled simultaneously.  This is why
I had added /sys/fs/ext4/features/encrypted_casefold.  It was
originally not to indicate whether the on-disk file system supported
those features, but to indicate that the kernel in question supported
both features being enabled simultaneously.

					- Ted

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04 18:58             ` Theodore Ts'o
  0 siblings, 0 replies; 48+ messages in thread
From: Theodore Ts'o @ 2021-06-04 18:58 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, Eric Biggers, linux-fsdevel,
	Gabriel Krisman Bertazi

On Thu, Jun 03, 2021 at 10:38:48PM -0700, Jaegeuk Kim wrote:
 > > Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> > means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
> 
> I prefer to keep encrypted_casefold likewise kernel feature, which is more
> intuitive to users.

At least for ext4, there are kernel vesions which support encryption
and casefold *separetely*, but which do not support the file systems
that have encryption and casefold enabled simultaneously.  This is why
I had added /sys/fs/ext4/features/encrypted_casefold.  It was
originally not to indicate whether the on-disk file system supported
those features, but to indicate that the kernel in question supported
both features being enabled simultaneously.

					- Ted


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 1/2] f2fs: Show casefolding support only when supported
  2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-04 23:46     ` Chao Yu
  -1 siblings, 0 replies; 48+ messages in thread
From: Chao Yu @ 2021-06-04 23:46 UTC (permalink / raw)
  To: Daniel Rosenberg, Jaegeuk Kim, linux-f2fs-devel
  Cc: linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, stable

On 2021/6/3 17:50, Daniel Rosenberg wrote:
> The casefolding feature is only supported when CONFIG_UNICODE is set.
> This modifies the feature list f2fs presents under sysfs accordingly.
> 
> Fixes: 5aba54302a46 ("f2fs: include charset encoding information in the superblock")
> Cc: stable@vger.kernel.org # v5.4+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [f2fs-dev] [PATCH v2 1/2] f2fs: Show casefolding support only when supported
@ 2021-06-04 23:46     ` Chao Yu
  0 siblings, 0 replies; 48+ messages in thread
From: Chao Yu @ 2021-06-04 23:46 UTC (permalink / raw)
  To: Daniel Rosenberg, Jaegeuk Kim, linux-f2fs-devel
  Cc: linux-fsdevel, kernel-team, Gabriel Krisman Bertazi,
	linux-kernel, stable

On 2021/6/3 17:50, Daniel Rosenberg wrote:
> The casefolding feature is only supported when CONFIG_UNICODE is set.
> This modifies the feature list f2fs presents under sysfs accordingly.
> 
> Fixes: 5aba54302a46 ("f2fs: include charset encoding information in the superblock")
> Cc: stable@vger.kernel.org # v5.4+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
@ 2021-06-04 23:46     ` Chao Yu
  -1 siblings, 0 replies; 48+ messages in thread
From: Chao Yu @ 2021-06-04 23:46 UTC (permalink / raw)
  To: Daniel Rosenberg, Jaegeuk Kim, linux-f2fs-devel
  Cc: linux-kernel, linux-fsdevel, Gabriel Krisman Bertazi,
	kernel-team, stable

On 2021/6/3 17:50, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-04 23:46     ` Chao Yu
  0 siblings, 0 replies; 48+ messages in thread
From: Chao Yu @ 2021-06-04 23:46 UTC (permalink / raw)
  To: Daniel Rosenberg, Jaegeuk Kim, linux-f2fs-devel
  Cc: linux-fsdevel, kernel-team, Gabriel Krisman Bertazi,
	linux-kernel, stable

On 2021/6/3 17:50, Daniel Rosenberg wrote:
> Older kernels don't support encryption with casefolding. This adds
> the sysfs entry encrypted_casefold to show support for those combined
> features. Support for this feature was originally added by
> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> 
> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> Cc: stable@vger.kernel.org # v5.11+
> Signed-off-by: Daniel Rosenberg <drosen@google.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-04  5:38           ` [f2fs-dev] " Jaegeuk Kim
@ 2021-06-05  0:11             ` Chao Yu
  -1 siblings, 0 replies; 48+ messages in thread
From: Chao Yu @ 2021-06-05  0:11 UTC (permalink / raw)
  To: Jaegeuk Kim, Eric Biggers
  Cc: Daniel Rosenberg, linux-f2fs-devel, linux-kernel, linux-fsdevel,
	Gabriel Krisman Bertazi, kernel-team, stable

On 2021/6/4 13:38, Jaegeuk Kim wrote:
> On 06/03, Eric Biggers wrote:
>> On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
>>> On 06/03, Eric Biggers wrote:
>>>> On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
>>>>> Older kernels don't support encryption with casefolding. This adds
>>>>> the sysfs entry encrypted_casefold to show support for those combined
>>>>> features. Support for this feature was originally added by
>>>>> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
>>>>>
>>>>> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
>>>>> Cc: stable@vger.kernel.org # v5.11+
>>>>> Signed-off-by: Daniel Rosenberg <drosen@google.com>
>>>>> ---
>>>>>   fs/f2fs/sysfs.c | 15 +++++++++++++--
>>>>>   1 file changed, 13 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
>>>>> index 09e3f258eb52..6604291a3cdf 100644
>>>>> --- a/fs/f2fs/sysfs.c
>>>>> +++ b/fs/f2fs/sysfs.c
>>>>> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>>>>>   	if (f2fs_sb_has_compression(sbi))
>>>>>   		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>>>>>   				len ? ", " : "", "compression");
>>>>> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
>>>>> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>>>>> +				len ? ", " : "", "encrypted_casefold");
>>>>>   	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>>>>>   				len ? ", " : "", "pin_file");
>>>>>   	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
>>>>> @@ -579,6 +582,7 @@ enum feat_id {
>>>>>   	FEAT_CASEFOLD,
>>>>>   	FEAT_COMPRESSION,
>>>>>   	FEAT_TEST_DUMMY_ENCRYPTION_V2,
>>>>> +	FEAT_ENCRYPTED_CASEFOLD,
>>>>>   };
>>>>
>>>> Actually looking at it more closely, this patch is wrong.
>>>>
>>>> It only makes sense to declare "encrypted_casefold" as a feature of the
>>>> filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
>>>>
>>>> It does *not* make sense to declare it as a feature of a particular filesystem
>>>> instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
>>>> filesystem instance having both the encryption and casefold features enabled.
>>>>
>>>> Can we add /sys/fs/f2fs/features/encrypted_casefold only?
>>>
>>> wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
>>> CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
>>> OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
>>> on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
>>>
>>
>> Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
>> means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
> 
> I prefer to keep encrypted_casefold likewise kernel feature, which is more
> intuitive to users.

encrypted_casefold is a kernel feature support flag, not a disk one, IMO, it's
not needed to add it in to per-disk feature list, it may mislead user that
compatible encrypted casefold needs a extra disk layout support while disk has
already encrypted and casefold feature enabled.

Thanks,

> 
>>
>> - Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-05  0:11             ` Chao Yu
  0 siblings, 0 replies; 48+ messages in thread
From: Chao Yu @ 2021-06-05  0:11 UTC (permalink / raw)
  To: Jaegeuk Kim, Eric Biggers
  Cc: Daniel Rosenberg, Gabriel Krisman Bertazi, linux-kernel, stable,
	linux-f2fs-devel, linux-fsdevel, kernel-team

On 2021/6/4 13:38, Jaegeuk Kim wrote:
> On 06/03, Eric Biggers wrote:
>> On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
>>> On 06/03, Eric Biggers wrote:
>>>> On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
>>>>> Older kernels don't support encryption with casefolding. This adds
>>>>> the sysfs entry encrypted_casefold to show support for those combined
>>>>> features. Support for this feature was originally added by
>>>>> commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
>>>>>
>>>>> Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
>>>>> Cc: stable@vger.kernel.org # v5.11+
>>>>> Signed-off-by: Daniel Rosenberg <drosen@google.com>
>>>>> ---
>>>>>   fs/f2fs/sysfs.c | 15 +++++++++++++--
>>>>>   1 file changed, 13 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
>>>>> index 09e3f258eb52..6604291a3cdf 100644
>>>>> --- a/fs/f2fs/sysfs.c
>>>>> +++ b/fs/f2fs/sysfs.c
>>>>> @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
>>>>>   	if (f2fs_sb_has_compression(sbi))
>>>>>   		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>>>>>   				len ? ", " : "", "compression");
>>>>> +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
>>>>> +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>>>>> +				len ? ", " : "", "encrypted_casefold");
>>>>>   	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
>>>>>   				len ? ", " : "", "pin_file");
>>>>>   	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
>>>>> @@ -579,6 +582,7 @@ enum feat_id {
>>>>>   	FEAT_CASEFOLD,
>>>>>   	FEAT_COMPRESSION,
>>>>>   	FEAT_TEST_DUMMY_ENCRYPTION_V2,
>>>>> +	FEAT_ENCRYPTED_CASEFOLD,
>>>>>   };
>>>>
>>>> Actually looking at it more closely, this patch is wrong.
>>>>
>>>> It only makes sense to declare "encrypted_casefold" as a feature of the
>>>> filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
>>>>
>>>> It does *not* make sense to declare it as a feature of a particular filesystem
>>>> instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
>>>> filesystem instance having both the encryption and casefold features enabled.
>>>>
>>>> Can we add /sys/fs/f2fs/features/encrypted_casefold only?
>>>
>>> wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
>>> CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
>>> OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
>>> on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
>>>
>>
>> Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
>> means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
> 
> I prefer to keep encrypted_casefold likewise kernel feature, which is more
> intuitive to users.

encrypted_casefold is a kernel feature support flag, not a disk one, IMO, it's
not needed to add it in to per-disk feature list, it may mislead user that
compatible encrypted casefold needs a extra disk layout support while disk has
already encrypted and casefold feature enabled.

Thanks,

> 
>>
>> - Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
  2021-06-05  0:11             ` [f2fs-dev] " Chao Yu
@ 2021-06-05  0:15               ` Jaegeuk Kim
  -1 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-05  0:15 UTC (permalink / raw)
  To: Chao Yu
  Cc: Eric Biggers, Daniel Rosenberg, linux-f2fs-devel, linux-kernel,
	linux-fsdevel, Gabriel Krisman Bertazi, kernel-team, stable

On 06/05, Chao Yu wrote:
> On 2021/6/4 13:38, Jaegeuk Kim wrote:
> > On 06/03, Eric Biggers wrote:
> > > On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> > > > On 06/03, Eric Biggers wrote:
> > > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > > features. Support for this feature was originally added by
> > > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > 
> > > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > > ---
> > > > > >   fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > > >   1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > > --- a/fs/f2fs/sysfs.c
> > > > > > +++ b/fs/f2fs/sysfs.c
> > > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > > >   	if (f2fs_sb_has_compression(sbi))
> > > > > >   		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >   				len ? ", " : "", "compression");
> > > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > > >   	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >   				len ? ", " : "", "pin_file");
> > > > > >   	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > > > @@ -579,6 +582,7 @@ enum feat_id {
> > > > > >   	FEAT_CASEFOLD,
> > > > > >   	FEAT_COMPRESSION,
> > > > > >   	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > > > > +	FEAT_ENCRYPTED_CASEFOLD,
> > > > > >   };
> > > > > 
> > > > > Actually looking at it more closely, this patch is wrong.
> > > > > 
> > > > > It only makes sense to declare "encrypted_casefold" as a feature of the
> > > > > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > > > > 
> > > > > It does *not* make sense to declare it as a feature of a particular filesystem
> > > > > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > > > > filesystem instance having both the encryption and casefold features enabled.
> > > > > 
> > > > > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> > > > 
> > > > wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> > > > CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> > > > OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> > > > on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> > > > 
> > > 
> > > Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> > > means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
> > 
> > I prefer to keep encrypted_casefold likewise kernel feature, which is more
> > intuitive to users.
> 
> encrypted_casefold is a kernel feature support flag, not a disk one, IMO, it's
> not needed to add it in to per-disk feature list, it may mislead user that
> compatible encrypted casefold needs a extra disk layout support while disk has
> already encrypted and casefold feature enabled.

Yeah, I overlooked, and per Ted and Daniel's comments, I already removed it
locally, but couldn't post it yet. :P

> 
> Thanks,
> 
> > 
> > > 
> > > - Eric

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

* Re: [f2fs-dev] [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs
@ 2021-06-05  0:15               ` Jaegeuk Kim
  0 siblings, 0 replies; 48+ messages in thread
From: Jaegeuk Kim @ 2021-06-05  0:15 UTC (permalink / raw)
  To: Chao Yu
  Cc: Daniel Rosenberg, kernel-team, linux-kernel, stable,
	linux-f2fs-devel, Eric Biggers, linux-fsdevel,
	Gabriel Krisman Bertazi

On 06/05, Chao Yu wrote:
> On 2021/6/4 13:38, Jaegeuk Kim wrote:
> > On 06/03, Eric Biggers wrote:
> > > On Thu, Jun 03, 2021 at 09:45:25PM -0700, Jaegeuk Kim wrote:
> > > > On 06/03, Eric Biggers wrote:
> > > > > On Thu, Jun 03, 2021 at 09:50:38AM +0000, Daniel Rosenberg wrote:
> > > > > > Older kernels don't support encryption with casefolding. This adds
> > > > > > the sysfs entry encrypted_casefold to show support for those combined
> > > > > > features. Support for this feature was originally added by
> > > > > > commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > 
> > > > > > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > > > > > Cc: stable@vger.kernel.org # v5.11+
> > > > > > Signed-off-by: Daniel Rosenberg <drosen@google.com>
> > > > > > ---
> > > > > >   fs/f2fs/sysfs.c | 15 +++++++++++++--
> > > > > >   1 file changed, 13 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > > > > > index 09e3f258eb52..6604291a3cdf 100644
> > > > > > --- a/fs/f2fs/sysfs.c
> > > > > > +++ b/fs/f2fs/sysfs.c
> > > > > > @@ -161,6 +161,9 @@ static ssize_t features_show(struct f2fs_attr *a,
> > > > > >   	if (f2fs_sb_has_compression(sbi))
> > > > > >   		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >   				len ? ", " : "", "compression");
> > > > > > +	if (f2fs_sb_has_casefold(sbi) && f2fs_sb_has_encrypt(sbi))
> > > > > > +		len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > > +				len ? ", " : "", "encrypted_casefold");
> > > > > >   	len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> > > > > >   				len ? ", " : "", "pin_file");
> > > > > >   	len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> > > > > > @@ -579,6 +582,7 @@ enum feat_id {
> > > > > >   	FEAT_CASEFOLD,
> > > > > >   	FEAT_COMPRESSION,
> > > > > >   	FEAT_TEST_DUMMY_ENCRYPTION_V2,
> > > > > > +	FEAT_ENCRYPTED_CASEFOLD,
> > > > > >   };
> > > > > 
> > > > > Actually looking at it more closely, this patch is wrong.
> > > > > 
> > > > > It only makes sense to declare "encrypted_casefold" as a feature of the
> > > > > filesystem implementation, i.e. /sys/fs/f2fs/features/encrypted_casefold.
> > > > > 
> > > > > It does *not* make sense to declare it as a feature of a particular filesystem
> > > > > instance, i.e. /sys/fs/f2fs/$disk/features, as it is already implied by the
> > > > > filesystem instance having both the encryption and casefold features enabled.
> > > > > 
> > > > > Can we add /sys/fs/f2fs/features/encrypted_casefold only?
> > > > 
> > > > wait.. /sys/fs/f2fs/features/encrypted_casefold is on by
> > > > CONFIG_FS_ENCRYPTION && CONFIG_UNICODE.
> > > > OTOH, /sys/fs/f2fs/$dis/feature_list/encrypted_casefold is on by
> > > > on-disk features: F2FS_FEATURE_ENCRYPT and F2FS_FEATURE_CASEFOLD.
> > > > 
> > > 
> > > Yes, but in the on-disk case, encrypted_casefold is redundant because it simply
> > > means encrypt && casefold.  There is no encrypted_casefold flag on-disk.
> > 
> > I prefer to keep encrypted_casefold likewise kernel feature, which is more
> > intuitive to users.
> 
> encrypted_casefold is a kernel feature support flag, not a disk one, IMO, it's
> not needed to add it in to per-disk feature list, it may mislead user that
> compatible encrypted casefold needs a extra disk layout support while disk has
> already encrypted and casefold feature enabled.

Yeah, I overlooked, and per Ted and Daniel's comments, I already removed it
locally, but couldn't post it yet. :P

> 
> Thanks,
> 
> > 
> > > 
> > > - Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2021-06-05  0:15 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  9:50 [PATCH v2 0/2] Fix up casefolding sysfs entries for F2FS Daniel Rosenberg
2021-06-03  9:50 ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
2021-06-03  9:50 ` [PATCH v2 1/2] f2fs: Show casefolding support only when supported Daniel Rosenberg
2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
2021-06-03 18:20   ` Eric Biggers
2021-06-03 18:20     ` [f2fs-dev] " Eric Biggers
2021-06-04 23:46   ` Chao Yu
2021-06-04 23:46     ` [f2fs-dev] " Chao Yu
2021-06-03  9:50 ` [PATCH v2 2/2] f2fs: Advertise encrypted casefolding in sysfs Daniel Rosenberg
2021-06-03  9:50   ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
2021-06-03 10:04   ` Greg KH
2021-06-03 10:04     ` [f2fs-dev] " Greg KH
2021-06-03 15:40     ` Jaegeuk Kim
2021-06-03 15:40       ` [f2fs-dev] " Jaegeuk Kim
2021-06-03 17:26       ` Greg KH
2021-06-03 17:26         ` [f2fs-dev] " Greg KH
2021-06-03 17:53         ` Jaegeuk Kim
2021-06-03 17:53           ` [f2fs-dev] " Jaegeuk Kim
2021-06-03 18:12           ` Greg KH
2021-06-03 18:12             ` [f2fs-dev] " Greg KH
2021-06-03 19:20             ` Jaegeuk Kim
2021-06-03 19:20               ` [f2fs-dev] " Jaegeuk Kim
2021-06-03 20:54             ` David Laight
2021-06-03 20:54               ` [f2fs-dev] " David Laight
2021-06-03 18:26   ` Eric Biggers
2021-06-03 18:26     ` [f2fs-dev] " Eric Biggers
2021-06-03 23:21   ` Eric Biggers
2021-06-03 23:21     ` [f2fs-dev] " Eric Biggers
2021-06-04  4:45     ` Jaegeuk Kim
2021-06-04  4:45       ` [f2fs-dev] " Jaegeuk Kim
2021-06-04  5:01       ` Eric Biggers
2021-06-04  5:01         ` [f2fs-dev] " Eric Biggers
2021-06-04  5:38         ` Jaegeuk Kim
2021-06-04  5:38           ` [f2fs-dev] " Jaegeuk Kim
2021-06-04  5:54           ` Daniel Rosenberg
2021-06-04  5:54             ` [f2fs-dev] " Daniel Rosenberg via Linux-f2fs-devel
2021-06-04 18:58           ` Theodore Ts'o
2021-06-04 18:58             ` [f2fs-dev] " Theodore Ts'o
2021-06-05  0:11           ` Chao Yu
2021-06-05  0:11             ` [f2fs-dev] " Chao Yu
2021-06-05  0:15             ` Jaegeuk Kim
2021-06-05  0:15               ` [f2fs-dev] " Jaegeuk Kim
2021-06-04  8:27       ` David Laight
2021-06-04  8:27         ` [f2fs-dev] " David Laight
2021-06-04  8:33         ` Greg KH
2021-06-04  8:33           ` [f2fs-dev] " Greg KH
2021-06-04 23:46   ` Chao Yu
2021-06-04 23:46     ` [f2fs-dev] " Chao Yu

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.