aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/background.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/background.c')
-rw-r--r--fs/jffs2/background.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 2b60ce1996aa..bb9cebc9ca8a 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -75,10 +75,13 @@ void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
75static int jffs2_garbage_collect_thread(void *_c) 75static int jffs2_garbage_collect_thread(void *_c)
76{ 76{
77 struct jffs2_sb_info *c = _c; 77 struct jffs2_sb_info *c = _c;
78 sigset_t hupmask;
78 79
80 siginitset(&hupmask, sigmask(SIGHUP));
79 allow_signal(SIGKILL); 81 allow_signal(SIGKILL);
80 allow_signal(SIGSTOP); 82 allow_signal(SIGSTOP);
81 allow_signal(SIGCONT); 83 allow_signal(SIGCONT);
84 allow_signal(SIGHUP);
82 85
83 c->gc_task = current; 86 c->gc_task = current;
84 complete(&c->gc_thread_start); 87 complete(&c->gc_thread_start);
@@ -87,7 +90,7 @@ static int jffs2_garbage_collect_thread(void *_c)
87 90
88 set_freezable(); 91 set_freezable();
89 for (;;) { 92 for (;;) {
90 allow_signal(SIGHUP); 93 sigprocmask(SIG_UNBLOCK, &hupmask, NULL);
91 again: 94 again:
92 spin_lock(&c->erase_completion_lock); 95 spin_lock(&c->erase_completion_lock);
93 if (!jffs2_thread_should_wake(c)) { 96 if (!jffs2_thread_should_wake(c)) {
@@ -95,10 +98,9 @@ static int jffs2_garbage_collect_thread(void *_c)
95 spin_unlock(&c->erase_completion_lock); 98 spin_unlock(&c->erase_completion_lock);
96 jffs2_dbg(1, "%s(): sleeping...\n", __func__); 99 jffs2_dbg(1, "%s(): sleeping...\n", __func__);
97 schedule(); 100 schedule();
98 } else 101 } else {
99 spin_unlock(&c->erase_completion_lock); 102 spin_unlock(&c->erase_completion_lock);
100 103 }
101
102 /* Problem - immediately after bootup, the GCD spends a lot 104 /* Problem - immediately after bootup, the GCD spends a lot
103 * of time in places like jffs2_kill_fragtree(); so much so 105 * of time in places like jffs2_kill_fragtree(); so much so
104 * that userspace processes (like gdm and X) are starved 106 * that userspace processes (like gdm and X) are starved
@@ -150,7 +152,7 @@ static int jffs2_garbage_collect_thread(void *_c)
150 } 152 }
151 } 153 }
152 /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */ 154 /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */
153 disallow_signal(SIGHUP); 155 sigprocmask(SIG_BLOCK, &hupmask, NULL);
154 156
155 jffs2_dbg(1, "%s(): pass\n", __func__); 157 jffs2_dbg(1, "%s(): pass\n", __func__);
156 if (jffs2_garbage_collect_pass(c) == -ENOSPC) { 158 if (jffs2_garbage_collect_pass(c) == -ENOSPC) {