Commit bde40fe0 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubifs-2.6

* 'linux-next' of git://git.infradead.org/~dedekind/ubifs-2.6:
  UBIFS: fix printk format warnings
  UBIFS: remove incorrect assert
  UBIFS: TNC / GC race fixes
  UBIFS: create the name of the background thread in every case
parents 6ef190cc 7424bac8
...@@ -538,7 +538,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node) ...@@ -538,7 +538,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node)
printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n); printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
printk(KERN_DEBUG "\t ino %llu\n", printk(KERN_DEBUG "\t ino %llu\n",
le64_to_cpu(orph->inos[i])); (unsigned long long)le64_to_cpu(orph->inos[i]));
break; break;
} }
default: default:
......
...@@ -426,7 +426,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) ...@@ -426,7 +426,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
while (1) { while (1) {
dbg_gen("feed '%s', ino %llu, new f_pos %#x", dbg_gen("feed '%s', ino %llu, new f_pos %#x",
dent->name, le64_to_cpu(dent->inum), dent->name, (unsigned long long)le64_to_cpu(dent->inum),
key_hash_flash(c, &dent->key)); key_hash_flash(c, &dent->key));
ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum); ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum);
......
...@@ -507,7 +507,6 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free, ...@@ -507,7 +507,6 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
rsvd_idx_lebs = 0; rsvd_idx_lebs = 0;
lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
c->lst.taken_empty_lebs; c->lst.taken_empty_lebs;
ubifs_assert(lebs + c->lst.idx_lebs >= c->min_idx_lebs);
if (rsvd_idx_lebs < lebs) if (rsvd_idx_lebs < lebs)
/* /*
* OK to allocate an empty LEB, but we still don't want to go * OK to allocate an empty LEB, but we still don't want to go
......
...@@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) ...@@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
err = move_nodes(c, sleb); err = move_nodes(c, sleb);
if (err) if (err)
goto out; goto out_inc_seq;
err = gc_sync_wbufs(c); err = gc_sync_wbufs(c);
if (err) if (err)
goto out; goto out_inc_seq;
err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0); err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0);
if (err) if (err)
goto out; goto out_inc_seq;
/* Allow for races with TNC */ /* Allow for races with TNC */
c->gced_lnum = lnum; c->gced_lnum = lnum;
...@@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) ...@@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
out: out:
ubifs_scan_destroy(sleb); ubifs_scan_destroy(sleb);
return err; 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;
} }
/** /**
......
...@@ -1024,14 +1024,13 @@ static int mount_ubifs(struct ubifs_info *c) ...@@ -1024,14 +1024,13 @@ static int mount_ubifs(struct ubifs_info *c)
goto out_dereg; goto out_dereg;
} }
sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
if (!mounted_read_only) { if (!mounted_read_only) {
err = alloc_wbufs(c); err = alloc_wbufs(c);
if (err) if (err)
goto out_cbuf; goto out_cbuf;
/* Create background thread */ /* Create background thread */
sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num,
c->vi.vol_id);
c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name); c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
if (!c->bgt) if (!c->bgt)
c->bgt = ERR_PTR(-EINVAL); c->bgt = ERR_PTR(-EINVAL);
......
...@@ -1476,7 +1476,7 @@ int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, ...@@ -1476,7 +1476,7 @@ int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,
} }
err = fallible_read_node(c, key, &zbr, node); err = fallible_read_node(c, key, &zbr, node);
if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) { if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) {
/* /*
* The node may have been GC'ed out from under us so try again * The node may have been GC'ed out from under us so try again
* while keeping the TNC mutex locked. * while keeping the TNC mutex locked.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment