aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/gc.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-23 07:17:36 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-26 05:54:11 -0500
commite4d9b6cbfc98d696a28d2c24a3d49768695811ee (patch)
tree5d76848d68add2830efa29b16425e2f07b4f1967 /fs/ubifs/gc.c
parent82c1593cad3dfc97661764c8bc62aa1a416e9ea8 (diff)
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.c16
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:
830 * ubifs_destroy_idx_gc - destroy idx_gc list. 830 * ubifs_destroy_idx_gc - destroy idx_gc list.
831 * @c: UBIFS file-system description object 831 * @c: UBIFS file-system description object
832 * 832 *
833 * This function destroys the idx_gc list. It is called when unmounting or 833 * This function destroys the @c->idx_gc list. It is called when unmounting or
834 * remounting read-only so locks are not needed. 834 * remounting read-only so locks are not needed. Returns zero in case of
835 * success and a negative error code in case of failure.
835 */ 836 */
836void ubifs_destroy_idx_gc(struct ubifs_info *c) 837int ubifs_destroy_idx_gc(struct ubifs_info *c)
837{ 838{
839 int ret = 0;
840
838 while (!list_empty(&c->idx_gc)) { 841 while (!list_empty(&c->idx_gc)) {
842 int err;
839 struct ubifs_gced_idx_leb *idx_gc; 843 struct ubifs_gced_idx_leb *idx_gc;
840 844
841 idx_gc = list_entry(c->idx_gc.next, struct ubifs_gced_idx_leb, 845 idx_gc = list_entry(c->idx_gc.next, struct ubifs_gced_idx_leb,
842 list); 846 list);
843 c->idx_gc_cnt -= 1; 847 err = ubifs_change_one_lp(c, idx_gc->lnum, LPROPS_NC,
848 LPROPS_NC, 0, LPROPS_TAKEN, -1);
849 if (err && !ret)
850 ret = err;
844 list_del(&idx_gc->list); 851 list_del(&idx_gc->list);
845 kfree(idx_gc); 852 kfree(idx_gc);
846 } 853 }
847 854
855 return ret;
848} 856}
849 857
850/** 858/**