diff options
Diffstat (limited to 'fs/ubifs/commit.c')
-rw-r--r-- | fs/ubifs/commit.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index b2ca12f..87cd0ea 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c @@ -78,7 +78,7 @@ static int nothing_to_commit(struct ubifs_info *c) * If the root TNC node is dirty, we definitely have something to * commit. */ - if (c->zroot.znode && ubifs_zn_dirty(c->zroot.znode)) + if (c->zroot.znode && test_bit(DIRTY_ZNODE, &c->zroot.znode->flags)) return 0; /* @@ -166,10 +166,15 @@ static int do_commit(struct ubifs_info *c) err = ubifs_orphan_end_commit(c); if (err) goto out; + old_ltail_lnum = c->ltail_lnum; + err = ubifs_log_end_commit(c, new_ltail_lnum); + if (err) + goto out; err = dbg_check_old_index(c, &zroot); if (err) goto out; + mutex_lock(&c->mst_mutex); c->mst_node->cmt_no = cpu_to_le64(c->cmt_no); c->mst_node->log_lnum = cpu_to_le32(new_ltail_lnum); c->mst_node->root_lnum = cpu_to_le32(zroot.lnum); @@ -198,9 +203,8 @@ static int do_commit(struct ubifs_info *c) c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); else c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_NO_ORPHS); - - old_ltail_lnum = c->ltail_lnum; - err = ubifs_log_end_commit(c, new_ltail_lnum); + err = ubifs_write_master(c); + mutex_unlock(&c->mst_mutex); if (err) goto out; @@ -414,7 +418,7 @@ int ubifs_run_commit(struct ubifs_info *c) spin_lock(&c->cs_lock); if (c->cmt_state == COMMIT_BROKEN) { - err = -EROFS; + err = -EINVAL; goto out; } @@ -440,7 +444,7 @@ int ubifs_run_commit(struct ubifs_info *c) * re-check it. */ if (c->cmt_state == COMMIT_BROKEN) { - err = -EROFS; + err = -EINVAL; goto out_cmt_unlock; } @@ -572,7 +576,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot) struct idx_node *i; size_t sz; - if (!dbg_is_chk_index(c)) + if (!(ubifs_chk_flags & UBIFS_CHK_OLD_IDX)) return 0; INIT_LIST_HEAD(&list); |