summaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodemgmt.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-04-23 15:40:52 +0100
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-23 16:01:37 +0100
commit422b120238130307da64fa44c9fb722bfaf5f1af (patch)
tree72f47ac8dcd66ae074d1b4b916ffc8fe32183bf1 /fs/jffs2/nodemgmt.c
parente2bc322bf05936ec7160d62bc3fd45cbf4aa405a (diff)
downloadop-kernel-dev-422b120238130307da64fa44c9fb722bfaf5f1af.zip
op-kernel-dev-422b120238130307da64fa44c9fb722bfaf5f1af.tar.gz
[JFFS2] Fix jffs2_reserve_space() when all blocks are pending erasure.
When _all_ the blocks were on the erase_pending_list, we could't find a block to GC from but there was no _actually_ free space, and jffs2_reserve_space() would get a little unhappy. Handle this case by returning -EAGAIN from jffs2_garbage_collect_pass(). There are two callers of that function -- jffs2_flush_wbuf_gc(), which will interpret it as an error and flush the writebuffer by other means, and jffs2_reserve_space(), which we modify to respond to -EAGAIN with an immediate call to jffs2_erase_pending_blocks() and another run round the loop. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/nodemgmt.c')
-rw-r--r--fs/jffs2/nodemgmt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index 747a73f..9df8f3e 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -116,7 +116,10 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
spin_unlock(&c->erase_completion_lock);
ret = jffs2_garbage_collect_pass(c);
- if (ret)
+
+ if (ret == -EAGAIN)
+ jffs2_erase_pending_blocks(c, 1);
+ else if (ret)
return ret;
cond_resched();
OpenPOWER on IntegriCloud