Re: [PATCH V4 2/6] erofs: code clean up for fscache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 9/15/22 8:42 PM, Jia Zhu wrote:

> @@ -502,12 +493,19 @@ int erofs_fscache_register_fs(struct super_block *sb)
>  	volume = fscache_acquire_volume(name, NULL, NULL, 0);
>  	if (IS_ERR_OR_NULL(volume)) {
>  		erofs_err(sb, "failed to register volume for %s", name);
> -		ret = volume ? PTR_ERR(volume) : -EOPNOTSUPP;
> -		volume = NULL;
> +		kfree(name);
> +		return volume ? PTR_ERR(volume) : -EOPNOTSUPP;
>  	}
>  
>  	sbi->volume = volume;
>  	kfree(name);
> +
> +	fscache = erofs_fscache_register_cookie(sb, sbi->opt.fsid, true);
> +	/* acquired volume will be relinquished in kill_sb() */
> +	if (IS_ERR(fscache))
> +		return PTR_ERR(fscache);
> +
> +	sbi->s_fscache = fscache;
>  	return ret;

The local variable "ret" is not used in this case.


> @@ -889,7 +885,6 @@ static void erofs_kill_sb(struct super_block *sb)
>  
>  	erofs_free_dev_context(sbi->devs);
>  	fs_put_dax(sbi->dax_dev, NULL);
> -	erofs_fscache_unregister_cookie(&sbi->s_fscache);
>  	erofs_fscache_unregister_fs(sb);
>  	kfree(sbi->opt.fsid);
>  	kfree(sbi);
> @@ -909,7 +904,8 @@ static void erofs_put_super(struct super_block *sb)
>  	iput(sbi->managed_cache);
>  	sbi->managed_cache = NULL;
>  #endif
> -	erofs_fscache_unregister_cookie(&sbi->s_fscache);
> +	erofs_fscache_unregister_fs(sb);

> +	sbi->s_fscache = NULL;

This line is not needed since we already call
erofs_fscache_unregister_fs() here.


With these fixed:
Reviewed-by: Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx>

-- 
Thanks,
Jingbo



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux