Skip to contentSkip to conversation

f2fs: return proper error from start_gc_thread

PATCH In review Namjae Jeon 2 participants 3 messages May 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 f2fs: return proper error from start_gc_thread

From: Namjae Jeon <[email protected]>

when there is an error from kthread_run, then return proper error rather than returning -ENOMEM.

---
 fs/f2fs/gc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
index 25b083c..03d5ba1 100644
@@ -105,7 +105,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi)
 	if (IS_ERR(gc_th->f2fs_gc_task)) {
 		kfree(gc_th);
 		sbi->gc_thread = NULL;
-		return -ENOMEM;
+		return PTR_ERR(gc_th->f2fs_gc_task);
 	}
 	return 0;
 }
Signature · 9 lines
1.7.9.5


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
#1 lore raw
Quoted 16 lines · Namjae Jeon

From: Namjae Jeon <[email protected]>

when there is an error from kthread_run, then return proper error rather than returning -ENOMEM.

---
 fs/f2fs/gc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +0 -0
index 25b083c..03d5ba1 100644

fs/f2fs/gc.c int start_gc_thread(struct f2fs_sb_info *sbi) · line 106

Quoted 2 lines
fs/f2fs/gc.c +0 -0
@@ -105,7 +105,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi)
 	if (IS_ERR(gc_th->f2fs_gc_task)) {
 		kfree(gc_th);

gc_th is free'd here, save off PTR_ERR result to avoid use-after-free?

fs/f2fs/gc.c int start_gc_thread(struct f2fs_sb_info *sbi) · line 111

Quoted 7 lines
fs/f2fs/gc.c +1 -1
 		sbi->gc_thread = NULL;
-		return -ENOMEM;
+		return PTR_ERR(gc_th->f2fs_gc_task);
 	}
 	return 0;
 }

--
Jason Hrycay

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may

#2 lore raw

2013/5/23, Jason Hrycay <[email protected]>:

Quoted 12 lines · Namjae Jeon
Quoted 11 lines

From: Namjae Jeon <[email protected]>

when there is an error from kthread_run, then return proper error rather than returning -ENOMEM.

---
 fs/f2fs/gc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines

fs/f2fs/gc.c int start_gc_thread(struct f2fs_sb_info *sbi) · line 106

Quoted 7 lines
fs/f2fs/gc.c +0 -0
index 25b083c..03d5ba1 100644
@@ -105,7 +105,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi)
 	if (IS_ERR(gc_th->f2fs_gc_task)) {
 		kfree(gc_th);

gc_th is free'd here, save off PTR_ERR result to avoid use-after-free?

Yes, I will change this patch.
Thanks for review :)

Quoted 12 lines

fs/f2fs/gc.c int start_gc_thread(struct f2fs_sb_info *sbi) · line 111

Quoted 8 lines
fs/f2fs/gc.c +1 -1
 		sbi->gc_thread = NULL;
-		return -ENOMEM;
+		return PTR_ERR(gc_th->f2fs_gc_task);
 	}
 	return 0;
 }

--
Jason Hrycay

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may