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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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)
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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
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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
@@ -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
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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)
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 += scnprintf(buf + len, PAGE_SIZE - len, "%s%s", len ? ", " : "", "pin_file"); len += scnprintf(buf + len, PAGE_SIZE - len, "\n");len ? ", " : "", "encrypted_casefold");
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
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-stable-mirror@lists.linaro.org