fs/erofs/super.c | 5 +++++ 1 file changed, 5 insertions(+)
Clean up the cache when cached decompression strategy is changed to
EROFS_ZIP_CACHE_DISABLED by remount.
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
---
fs/erofs/super.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 320d586c3896..de2af862e65b 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -743,6 +743,11 @@ static int erofs_fc_reconfigure(struct fs_context *fc)
else
fc->sb_flags &= ~SB_POSIXACL;
+ if (new_sbi->opt.cache_strategy == EROFS_ZIP_CACHE_DISABLED) {
+ mutex_lock(&sbi->umount_mutex);
+ z_erofs_shrink_scan(sbi, ~0UL);
+ mutex_unlock(&sbi->umount_mutex);
+ }
sbi->opt = new_sbi->opt;
fc->sb_flags |= SB_RDONLY;
--
2.34.1
Hi Chunhai,
kernel test robot noticed the following build errors:
[auto build test ERROR on xiang-erofs/dev-test]
[also build test ERROR on xiang-erofs/dev xiang-erofs/fixes linus/master v6.12-rc7 next-20241112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Chunhai-Guo/erofs-clean-up-the-cache-if-cached-decompression-is-disabled/20241112-105927
base: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test
patch link: https://lore.kernel.org/r/20241112031513.528474-1-guochunhai%40vivo.com
patch subject: [PATCH] erofs: clean up the cache if cached decompression is disabled
config: x86_64-randconfig-004-20241112 (https://download.01.org/0day-ci/archive/20241112/202411121928.BzWJRXSl-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411121928.BzWJRXSl-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411121928.BzWJRXSl-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from fs/erofs/super.c:10:
In file included from include/linux/fs_context.h:14:
In file included from include/linux/security.h:33:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> fs/erofs/super.c:749:20: error: no member named 'umount_mutex' in 'struct erofs_sb_info'
749 | mutex_lock(&sbi->umount_mutex);
| ~~~ ^
include/linux/mutex.h:166:44: note: expanded from macro 'mutex_lock'
166 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^~~~
>> fs/erofs/super.c:750:3: error: call to undeclared function 'z_erofs_shrink_scan'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
750 | z_erofs_shrink_scan(sbi, ~0UL);
| ^
fs/erofs/super.c:751:22: error: no member named 'umount_mutex' in 'struct erofs_sb_info'
751 | mutex_unlock(&sbi->umount_mutex);
| ~~~ ^
1 warning and 3 errors generated.
vim +749 fs/erofs/super.c
731
732 static int erofs_fc_reconfigure(struct fs_context *fc)
733 {
734 struct super_block *sb = fc->root->d_sb;
735 struct erofs_sb_info *sbi = EROFS_SB(sb);
736 struct erofs_sb_info *new_sbi = fc->s_fs_info;
737
738 DBG_BUGON(!sb_rdonly(sb));
739
740 if (new_sbi->fsid || new_sbi->domain_id)
741 erofs_info(sb, "ignoring reconfiguration for fsid|domain_id.");
742
743 if (test_opt(&new_sbi->opt, POSIX_ACL))
744 fc->sb_flags |= SB_POSIXACL;
745 else
746 fc->sb_flags &= ~SB_POSIXACL;
747
748 if (new_sbi->opt.cache_strategy == EROFS_ZIP_CACHE_DISABLED) {
> 749 mutex_lock(&sbi->umount_mutex);
> 750 z_erofs_shrink_scan(sbi, ~0UL);
751 mutex_unlock(&sbi->umount_mutex);
752 }
753 sbi->opt = new_sbi->opt;
754
755 fc->sb_flags |= SB_RDONLY;
756 return 0;
757 }
758
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Chunhai,
kernel test robot noticed the following build errors:
[auto build test ERROR on xiang-erofs/dev-test]
[also build test ERROR on xiang-erofs/dev xiang-erofs/fixes linus/master v6.12-rc7 next-20241112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Chunhai-Guo/erofs-clean-up-the-cache-if-cached-decompression-is-disabled/20241112-105927
base: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test
patch link: https://lore.kernel.org/r/20241112031513.528474-1-guochunhai%40vivo.com
patch subject: [PATCH] erofs: clean up the cache if cached decompression is disabled
config: x86_64-randconfig-161-20241112 (https://download.01.org/0day-ci/archive/20241112/202411121801.vd2yHEHx-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411121801.vd2yHEHx-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411121801.vd2yHEHx-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/seq_file.h:9,
from fs/erofs/super.c:8:
fs/erofs/super.c: In function 'erofs_fc_reconfigure':
>> fs/erofs/super.c:749:32: error: 'struct erofs_sb_info' has no member named 'umount_mutex'
749 | mutex_lock(&sbi->umount_mutex);
| ^~
include/linux/mutex.h:166:44: note: in definition of macro 'mutex_lock'
166 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^~~~
>> fs/erofs/super.c:750:17: error: implicit declaration of function 'z_erofs_shrink_scan' [-Werror=implicit-function-declaration]
750 | z_erofs_shrink_scan(sbi, ~0UL);
| ^~~~~~~~~~~~~~~~~~~
fs/erofs/super.c:751:34: error: 'struct erofs_sb_info' has no member named 'umount_mutex'
751 | mutex_unlock(&sbi->umount_mutex);
| ^~
cc1: some warnings being treated as errors
vim +749 fs/erofs/super.c
731
732 static int erofs_fc_reconfigure(struct fs_context *fc)
733 {
734 struct super_block *sb = fc->root->d_sb;
735 struct erofs_sb_info *sbi = EROFS_SB(sb);
736 struct erofs_sb_info *new_sbi = fc->s_fs_info;
737
738 DBG_BUGON(!sb_rdonly(sb));
739
740 if (new_sbi->fsid || new_sbi->domain_id)
741 erofs_info(sb, "ignoring reconfiguration for fsid|domain_id.");
742
743 if (test_opt(&new_sbi->opt, POSIX_ACL))
744 fc->sb_flags |= SB_POSIXACL;
745 else
746 fc->sb_flags &= ~SB_POSIXACL;
747
748 if (new_sbi->opt.cache_strategy == EROFS_ZIP_CACHE_DISABLED) {
> 749 mutex_lock(&sbi->umount_mutex);
> 750 z_erofs_shrink_scan(sbi, ~0UL);
751 mutex_unlock(&sbi->umount_mutex);
752 }
753 sbi->opt = new_sbi->opt;
754
755 fc->sb_flags |= SB_RDONLY;
756 return 0;
757 }
758
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On 2024/11/12 11:15, Chunhai Guo wrote:
> Clean up the cache when cached decompression strategy is changed to
> EROFS_ZIP_CACHE_DISABLED by remount.
>
> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
> ---
> fs/erofs/super.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 320d586c3896..de2af862e65b 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -743,6 +743,11 @@ static int erofs_fc_reconfigure(struct fs_context *fc)
> else
> fc->sb_flags &= ~SB_POSIXACL;
>
> + if (new_sbi->opt.cache_strategy == EROFS_ZIP_CACHE_DISABLED) {
I guess we need to check if
(sbi->opt.cache_strategy != new_sbi->opt.cache_strategy &&
new_sbi->opt.cache_strategy == EROFS_ZIP_CACHE_DISABLED)
Thanks,
Gao Xiang
> + mutex_lock(&sbi->umount_mutex);
> + z_erofs_shrink_scan(sbi, ~0UL);
> + mutex_unlock(&sbi->umount_mutex);
> + }
> sbi->opt = new_sbi->opt;
>
> fc->sb_flags |= SB_RDONLY;
© 2016 - 2025 Red Hat, Inc.