diff options
author | Adrian Hunter <ext-adrian.hunter@nokia.com> | 2008-09-12 12:27:47 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-09-17 14:23:26 +0300 |
commit | 6dcfac4f13d6b32fbaa60b64a23249999e66af8e (patch) | |
tree | 007884a8327658dc53252c7f1be9ab9daeb7ea14 /fs/ubifs/gc.c | |
parent | 0855f310dff76ae42c5aac32f600f8f692bbd23f (diff) | |
download | kernel_goldelico_gta04-6dcfac4f13d6b32fbaa60b64a23249999e66af8e.zip kernel_goldelico_gta04-6dcfac4f13d6b32fbaa60b64a23249999e66af8e.tar.gz kernel_goldelico_gta04-6dcfac4f13d6b32fbaa60b64a23249999e66af8e.tar.bz2 |
UBIFS: TNC / GC race fixes
- update GC sequence number if any nodes may have been moved
even if GC did not finish the LEB
- don't ignore error return when reading
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/gc.c')
-rw-r--r-- | fs/ubifs/gc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 13f1019..02aba36 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) err = move_nodes(c, sleb); if (err) - goto out; + goto out_inc_seq; err = gc_sync_wbufs(c); if (err) - goto out; + goto out_inc_seq; err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0); if (err) - goto out; + goto out_inc_seq; /* Allow for races with TNC */ c->gced_lnum = lnum; @@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) out: ubifs_scan_destroy(sleb); return err; + +out_inc_seq: + /* We may have moved at least some nodes so allow for races with TNC */ + c->gced_lnum = lnum; + smp_wmb(); + c->gc_seq += 1; + smp_wmb(); + goto out; } /** |