Skip to contentSkip to conversation

staging: erofs: set sb->s_root to NULL when failing from __getname()

PATCH New Chengguang Xu 3 participants 3 messages May 6, 2019 – May 7, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: erofs: set sb->s_root to NULL when failing from __getname()

Set sb->s_root to NULL when failing from __getname(), so that we can avoid double dput and unnecessary operations in generic_shutdown_super().

Signed-off-by Chengguang Xu <cgxu519 at gmail.com>
---
 drivers/staging/erofs/super.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/erofs/super.c +1 -0
index 15c784fba879..c8981662a49b 100644
@@ -459,6 +459,7 @@ static int erofs_read_super(struct super_block *sb,
 	 */
 err_devname:
 	dput(sb->s_root);
+	sb->s_root = NULL;
 err_iget:
 #ifdef EROFS_FS_HAS_MANAGED_CACHE
 	iput(sbi->managed_cache);
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 staging: erofs: set sb->s_root to NULL when failing from __getname()

Hi Chengguang,

Quoted 5 lines · Chengguang Xu

Set sb->s_root to NULL when failing from __getname(), so that we can avoid double dput and unnecessary operations in generic_shutdown_super().

Signed-off-by Chengguang Xu <cgxu519 at gmail.com>

Thanks for catching this issue and it makes sense.

Reviewed-by Gao Xiang <gaoxiang25 at huawei.com>

Thanks,
Gao Xiang

Quoted 17 lines
---
 drivers/staging/erofs/super.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/erofs/super.c +1 -0
index 15c784fba879..c8981662a49b 100644
@@ -459,6 +459,7 @@ static int erofs_read_super(struct super_block *sb,
 	 */
 err_devname:
 	dput(sb->s_root);
+	sb->s_root = NULL;
 err_iget:
 #ifdef EROFS_FS_HAS_MANAGED_CACHE
 	iput(sbi->managed_cache);
#2 lore raw

PATCH 1/1 staging: erofs: set sb->s_root to NULL when failing from __getname()

In reply to Chengguang Xu
Quoted 5 lines · Chengguang Xu

Set sb->s_root to NULL when failing from __getname(), so that we can avoid double dput and unnecessary operations in generic_shutdown_super().

Signed-off-by Chengguang Xu <cgxu519 at gmail.com>
Reviewed-by Chao Yu <yuchao0 at huawei.com>

Thanks,