[PATCH] erofs: fix lockdep false positives on initializing erofs_pseudo_mnt

Baokun Li libaokun1 at huawei.com
Thu Mar 7 18:06:49 AEDT 2024


On 2024/3/7 13:07, Al Viro wrote:
> On Thu, Mar 07, 2024 at 10:44:59AM +0800, Baokun Li wrote:
>
>> +static int erofs_anon_init_fs_context(struct fs_context *fc)
>> +{
>> +	fc->ops = &erofs_anon_context_ops;
>> +	return 0;
>> +}
>
> ITYM
>          struct pseudo_fs_context *ctx = init_pseudo(fc, EROFS_SUPER_MAGIC);
> 	return ctx ? 0 : -ENOMEM;
>
> and to hell with erofs_anon_context_ops, along with its fill_super, calls
> of simple_fill_super(), etc.  Unless I'm missing something, you are not
> even creating dentries here, let alone making them possible to look up.
Totally agree! It does streamline a lot!
>> +static void erofs_kill_pseudo_sb(struct super_block *sb)
>> +{
>> +	kill_anon_super(sb);
>> +}
> *blink*
>
> What's wrong with simply using kill_anon_super as ->kill_sb?
Sure, I'll just use kill_anon_super().
>> +int erofs_anon_register_fs(void)
>> +{
>> +	return register_filesystem(&erofs_anon_fs_type);
>> +}
> What for?  The only thing it gives you is an ability to look it up by
> name.  Which is completely pointless, IMO,
The helper function here is to avoid extern erofs_anon_fs_type(), because
we define it in fscache.c, but also use it in super.c. Moreover, we 
don't need
to register it when CONFIG_EROFS_FS_ONDEMAND is not enabled, so we
also use this helper function for code isolation.
>
>>   	if (!erofs_pseudo_mnt) {
>> -		struct vfsmount *mnt = kern_mount(&erofs_fs_type);
>> +		struct vfsmount *mnt = kern_mount(&erofs_anon_fs_type);
> ... since you are getting to it by direct reference to file_system_type
> anyway.  Same unregistering, of course...
Thanks for having a look!
-- 
With Best Regards,
Baokun Li
.


More information about the Linux-erofs mailing list