Skip to contentSkip to conversation

erofs: remove the guard of showing domain_id and fsid

PATCH In review Yuezhang Mo 3 participants 5 messages Mar 30 EROFS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs: remove the guard of showing domain_id and fsid

This change fixes an issue where domain_id was not shown when CONFIG_EROFS_FS_PAGE_CACHE_SHARE is enabled, as this configuration is mutually exclusive with CONFIG_EROFS_FS_ONDEMAND.

Both domain_id and fsid fields are present in struct erofs_sb_info regardless of configuration. They are not set if the configurations are not enabled, and remain NULL. Therefore, the conditional guard in erofs_show_options() are unnecessary and can be removed.

---
 fs/erofs/super.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
fs/erofs/super.c +4 -6
index 972a0c82198d..be028cdf902c 100644
@@ -1095,12 +1095,10 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_puts(seq, ",dax=never");
 	if (erofs_is_fileio_mode(sbi) && test_opt(opt, DIRECT_IO))
 		seq_puts(seq, ",directio");
-	if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND)) {
-		if (sbi->fsid)
-			seq_printf(seq, ",fsid=%s", sbi->fsid);
-		if (sbi->domain_id)
-			seq_printf(seq, ",domain_id=%s", sbi->domain_id);
-	}
+	if (sbi->fsid)
+		seq_printf(seq, ",fsid=%s", sbi->fsid);
+	if (sbi->domain_id)
+		seq_printf(seq, ",domain_id=%s", sbi->domain_id);
 	if (sbi->dif0.fsoff)
 		seq_printf(seq, ",fsoffset=%llu", sbi->dif0.fsoff);
 	if (test_opt(opt, INODE_SHARE))
Signature · 1 line
2.43.0
#1 lore raw

Hi Yuezhang,

Quoted 4 lines · Yuezhang Mo

This change fixes an issue where domain_id was not shown when CONFIG_EROFS_FS_PAGE_CACHE_SHARE is enabled, as this configuration is mutually exclusive with CONFIG_EROFS_FS_ONDEMAND.

Quoted 8 lines

Both domain_id and fsid fields are present in struct erofs_sb_info regardless of configuration. They are not set if the configurations are not enabled, and remain NULL. Therefore, the conditional guard in erofs_show_options() are unnecessary and can be removed.

domain_id is a user-sensitive information for the page cache sharing feature (much like passwd), so it shouldn't be shown in the mount option by design, and only the mounter should know what it was set.

Thanks,
Gao Xiang

Quoted 25 lines
---
  fs/erofs/super.c | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)
fs/erofs/super.c +4 -6
index 972a0c82198d..be028cdf902c 100644
@@ -1095,12 +1095,10 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
  		seq_puts(seq, ",dax=never");
  	if (erofs_is_fileio_mode(sbi) && test_opt(opt, DIRECT_IO))
  		seq_puts(seq, ",directio");
-	if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND)) {
-		if (sbi->fsid)
-			seq_printf(seq, ",fsid=%s", sbi->fsid);
-		if (sbi->domain_id)
-			seq_printf(seq, ",domain_id=%s", sbi->domain_id);
-	}
+	if (sbi->fsid)
+		seq_printf(seq, ",fsid=%s", sbi->fsid);
+	if (sbi->domain_id)
+		seq_printf(seq, ",domain_id=%s", sbi->domain_id);
  	if (sbi->dif0.fsoff)
  		seq_printf(seq, ",fsoffset=%llu", sbi->dif0.fsoff);
  	if (test_opt(opt, INODE_SHARE))
#2 lore raw
Quoted 10 lines · Yuezhang Mo
Quoted 9 lines

This change fixes an issue where domain_id was not shown when CONFIG_EROFS_FS_PAGE_CACHE_SHARE is enabled, as this configuration is mutually exclusive with CONFIG_EROFS_FS_ONDEMAND.

Both domain_id and fsid fields are present in struct erofs_sb_info regardless of configuration. They are not set if the configurations are not enabled, and remain NULL. Therefore, the conditional guard in erofs_show_options() are unnecessary and can be removed.

Quoted 8 lines
Quoted 3 lines

domain_id is a user-sensitive information for the page cache sharing feature (much like passwd), so it shouldn't be shown in the mount option by design, and only the mounter should know what it was set.

Oh, this is part of the design, not a bug. Thank you for your explanation.

#3 lore raw
Quoted 14 lines · On 2026/3/30 16:48, [email protected] wrote:
Quoted 14 lines · Yuezhang Mo
Quoted 12 lines

This change fixes an issue where domain_id was not shown when CONFIG_EROFS_FS_PAGE_CACHE_SHARE is enabled, as this configuration is mutually exclusive with CONFIG_EROFS_FS_ONDEMAND.

Both domain_id and fsid fields are present in struct erofs_sb_info regardless of configuration. They are not set if the configurations are not enabled, and remain NULL. Therefore, the conditional guard in erofs_show_options() are unnecessary and can be removed.

Quoted 6 lines
Quoted 4 lines

domain_id is a user-sensitive information for the page cache sharing feature (much like passwd), so it shouldn't be shown in the mount option by design, and only the mounter should know what it was set.

Oh, this is part of the design, not a bug. Thank you for your explanation.

Yes, if you need that information in the follow-up steps, you should keep somewhere in the userspace: but the proper permission is needed (e.g. like /etc/shadow).

Thanks,
Gao Xiang

#4 lore raw
In reply to Yuezhang Mo

Hi Yuezhang

Quoted 24 lines · Yuezhang Mo

This change fixes an issue where domain_id was not shown when CONFIG_EROFS_FS_PAGE_CACHE_SHARE is enabled, as this configuration is mutually exclusive with CONFIG_EROFS_FS_ONDEMAND.

Both domain_id and fsid fields are present in struct erofs_sb_info regardless of configuration. They are not set if the configurations are not enabled, and remain NULL. Therefore, the conditional guard in erofs_show_options() are unnecessary and can be removed.

---
  fs/erofs/super.c | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)
fs/erofs/super.c +0 -0
index 972a0c82198d..be028cdf902c 100644
@@ -1095,12 +1095,10 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
  		seq_puts(seq, ",dax=never");
  	if (erofs_is_fileio_mode(sbi) && test_opt(opt, DIRECT_IO))
  		seq_puts(seq, ",directio");

fs/erofs/super.c static int erofs_show_options(struct seq_file *seq, struct dentry *root) · line 1101

Quoted 10 lines
fs/erofs/super.c +4 -6
-	if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND)) {
-		if (sbi->fsid)
-			seq_printf(seq, ",fsid=%s", sbi->fsid);
-		if (sbi->domain_id)
-			seq_printf(seq, ",domain_id=%s", sbi->domain_id);
-	}
+	if (sbi->fsid)
+		seq_printf(seq, ",fsid=%s", sbi->fsid);
+	if (sbi->domain_id)
+		seq_printf(seq, ",domain_id=%s", sbi->domain_id);

The domain_id in CONFIG_EROFS_FS_PAGE_CACHE_SHARE case means the trusted domain. We cannot show it to user.

Thanks,
Hongbo

Quoted 3 lines
fs/erofs/super.c +0 -0
  	if (sbi->dif0.fsoff)
  		seq_printf(seq, ",fsoffset=%llu", sbi->dif0.fsoff);
  	if (test_opt(opt, INODE_SHARE))