diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-23 14:17:36 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-26 12:54:11 +0200 |
commit | e4d9b6cbfc98d696a28d2c24a3d49768695811ee (patch) | |
tree | 5d76848d68add2830efa29b16425e2f07b4f1967 /fs/ubifs/gc.c | |
parent | 82c1593cad3dfc97661764c8bc62aa1a416e9ea8 (diff) | |
download | linux-stable-e4d9b6cbfc98d696a28d2c24a3d49768695811ee.tar.gz linux-stable-e4d9b6cbfc98d696a28d2c24a3d49768695811ee.tar.bz2 linux-stable-e4d9b6cbfc98d696a28d2c24a3d49768695811ee.zip |
UBIFS: fix LEB list freeing
When freeing the c->idx_lebs list, we have to release the LEBs as well,
because we might be called from mount to read-only mode code. Otherwise
the LEBs stay taken forever, which may cause problems when we re-mount
back ro RW mode.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/gc.c')
-rw-r--r-- | fs/ubifs/gc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index b2e5f1133377..9760154d874b 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -830,21 +830,29 @@ out: * ubifs_destroy_idx_gc - destroy idx_gc list. * @c: UBIFS file-system description object * - * This function destroys the idx_gc list. It is called when unmounting or - * remounting read-only so locks are not needed. + * This function destroys the @c->idx_gc list. It is called when unmounting or + * remounting read-only so locks are not needed. Returns zero in case of + * success and a negative error code in case of failure. */ -void ubifs_destroy_idx_gc(struct ubifs_info *c) +int ubifs_destroy_idx_gc(struct ubifs_info *c) { + int ret = 0; + while (!list_empty(&c->idx_gc)) { + int err; struct ubifs_gced_idx_leb *idx_gc; idx_gc = list_entry(c->idx_gc.next, struct ubifs_gced_idx_leb, list); - c->idx_gc_cnt -= 1; + err = ubifs_change_one_lp(c, idx_gc->lnum, LPROPS_NC, + LPROPS_NC, 0, LPROPS_TAKEN, -1); + if (err && !ret) + ret = err; list_del(&idx_gc->list); kfree(idx_gc); } + return ret; } /** |