diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-19 12:00:10 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-19 12:10:22 -0400 |
commit | acb64a43e4503fbea9faf123f2403da7af8831eb (patch) | |
tree | 862d5ad6530b7c8671bda96a1bd1d07179f0b7c9 /fs/jffs2 | |
parent | d6ce171069635f05737935adc813b4d48d71a583 (diff) |
jffs2: Require jffs2_garbage_collect_trigger() to be called with lock held
We're about to call this from a bunch of places which already hold
c->erase_completion_lock, so add an assertion and change its existing
callers to do the same.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/background.c | 3 | ||||
-rw-r--r-- | fs/jffs2/nodemgmt.c | 2 | ||||
-rw-r--r-- | fs/jffs2/super.c | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 3ff50da94789..55f1dde2fa8b 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c | |||
@@ -23,10 +23,9 @@ static int jffs2_garbage_collect_thread(void *); | |||
23 | 23 | ||
24 | void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) | 24 | void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) |
25 | { | 25 | { |
26 | spin_lock(&c->erase_completion_lock); | 26 | assert_spin_locked(&c->erase_completion_lock); |
27 | if (c->gc_task && jffs2_thread_should_wake(c)) | 27 | if (c->gc_task && jffs2_thread_should_wake(c)) |
28 | send_sig(SIGHUP, c->gc_task, 1); | 28 | send_sig(SIGHUP, c->gc_task, 1); |
29 | spin_unlock(&c->erase_completion_lock); | ||
30 | } | 29 | } |
31 | 30 | ||
32 | /* This must only ever be called when no GC thread is currently running */ | 31 | /* This must only ever be called when no GC thread is currently running */ |
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index 5ab5c8521cdf..dd2d920d3325 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -481,7 +481,9 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c, | |||
481 | void jffs2_complete_reservation(struct jffs2_sb_info *c) | 481 | void jffs2_complete_reservation(struct jffs2_sb_info *c) |
482 | { | 482 | { |
483 | D1(printk(KERN_DEBUG "jffs2_complete_reservation()\n")); | 483 | D1(printk(KERN_DEBUG "jffs2_complete_reservation()\n")); |
484 | spin_lock(&c->erase_completion_lock); | ||
484 | jffs2_garbage_collect_trigger(c); | 485 | jffs2_garbage_collect_trigger(c); |
486 | spin_unlock(&c->erase_completion_lock); | ||
485 | mutex_unlock(&c->alloc_sem); | 487 | mutex_unlock(&c->alloc_sem); |
486 | } | 488 | } |
487 | 489 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 9a80e8e595d0..12cc967c5c03 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -63,7 +63,9 @@ static void jffs2_write_super(struct super_block *sb) | |||
63 | 63 | ||
64 | if (!(sb->s_flags & MS_RDONLY)) { | 64 | if (!(sb->s_flags & MS_RDONLY)) { |
65 | D1(printk(KERN_DEBUG "jffs2_write_super()\n")); | 65 | D1(printk(KERN_DEBUG "jffs2_write_super()\n")); |
66 | spin_lock(&c->erase_completion_lock); | ||
66 | jffs2_garbage_collect_trigger(c); | 67 | jffs2_garbage_collect_trigger(c); |
68 | spin_unlock(&c->erase_completion_lock); | ||
67 | jffs2_erase_pending_blocks(c, 0); | 69 | jffs2_erase_pending_blocks(c, 0); |
68 | jffs2_flush_wbuf_gc(c, 0); | 70 | jffs2_flush_wbuf_gc(c, 0); |
69 | } | 71 | } |