aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/ubifs.h
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2008-08-22 07:23:35 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-25 07:34:02 -0400
commit601c0bc46753007be011b513ba4fc50ed8e30aef (patch)
tree39017065a8418b60362686a7771afe138e100c08 /fs/ubifs/ubifs.h
parent761e29f3bb19b05bea55285dfdf2d28e001a63b8 (diff)
UBIFS: allow for racing between GC and TNC
The TNC mutex is unlocked prematurely when reading leaf nodes with non-hashed keys. This is unsafe because the node may be moved by garbage collection and the eraseblock unmapped, although that has never actually happened during stress testing. This patch fixes the flaw by detecting the race and retrying with the TNC mutex locked. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'fs/ubifs/ubifs.h')
-rw-r--r--fs/ubifs/ubifs.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index d7f706f7a302..7828d69ca4f8 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1028,6 +1028,8 @@ struct ubifs_mount_opts {
1028 * @sbuf: a buffer of LEB size used by GC and replay for scanning 1028 * @sbuf: a buffer of LEB size used by GC and replay for scanning
1029 * @idx_gc: list of index LEBs that have been garbage collected 1029 * @idx_gc: list of index LEBs that have been garbage collected
1030 * @idx_gc_cnt: number of elements on the idx_gc list 1030 * @idx_gc_cnt: number of elements on the idx_gc list
1031 * @gc_seq: incremented for every non-index LEB garbage collected
1032 * @gced_lnum: last non-index LEB that was garbage collected
1031 * 1033 *
1032 * @infos_list: links all 'ubifs_info' objects 1034 * @infos_list: links all 'ubifs_info' objects
1033 * @umount_mutex: serializes shrinker and un-mount 1035 * @umount_mutex: serializes shrinker and un-mount
@@ -1257,6 +1259,8 @@ struct ubifs_info {
1257 void *sbuf; 1259 void *sbuf;
1258 struct list_head idx_gc; 1260 struct list_head idx_gc;
1259 int idx_gc_cnt; 1261 int idx_gc_cnt;
1262 volatile int gc_seq;
1263 volatile int gced_lnum;
1260 1264
1261 struct list_head infos_list; 1265 struct list_head infos_list;
1262 struct mutex umount_mutex; 1266 struct mutex umount_mutex;
@@ -1451,8 +1455,6 @@ int ubifs_save_dirty_idx_lnums(struct ubifs_info *c);
1451/* tnc.c */ 1455/* tnc.c */
1452int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, 1456int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key,
1453 struct ubifs_znode **zn, int *n); 1457 struct ubifs_znode **zn, int *n);
1454int ubifs_tnc_lookup(struct ubifs_info *c, const union ubifs_key *key,
1455 void *node);
1456int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, 1458int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key,
1457 void *node, const struct qstr *nm); 1459 void *node, const struct qstr *nm);
1458int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, 1460int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,