diff options
Diffstat (limited to 'fs/jffs2/nodemgmt.c')
-rw-r--r-- | fs/jffs2/nodemgmt.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index 191359dde4e1..08e2c69fc147 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -116,9 +116,21 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, | |||
116 | 116 | ||
117 | ret = jffs2_garbage_collect_pass(c); | 117 | ret = jffs2_garbage_collect_pass(c); |
118 | 118 | ||
119 | if (ret == -EAGAIN) | 119 | if (ret == -EAGAIN) { |
120 | jffs2_erase_pending_blocks(c, 1); | 120 | spin_lock(&c->erase_completion_lock); |
121 | else if (ret) | 121 | if (c->nr_erasing_blocks && |
122 | list_empty(&c->erase_pending_list) && | ||
123 | list_empty(&c->erase_complete_list)) { | ||
124 | DECLARE_WAITQUEUE(wait, current); | ||
125 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
126 | add_wait_queue(&c->erase_wait, &wait); | ||
127 | D1(printk(KERN_DEBUG "%s waiting for erase to complete\n", __func__)); | ||
128 | spin_unlock(&c->erase_completion_lock); | ||
129 | |||
130 | schedule(); | ||
131 | } else | ||
132 | spin_unlock(&c->erase_completion_lock); | ||
133 | } else if (ret) | ||
122 | return ret; | 134 | return ret; |
123 | 135 | ||
124 | cond_resched(); | 136 | cond_resched(); |