Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164053
b: refs/heads/master
c: 0dcd18e
h: refs/heads/master
i:
  164051: 6b055de
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Sep 10, 2009
1 parent 80d3c05 commit 9189248
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 348709bad348d2fd013e1529b4cf5f220717c328
refs/heads/master: 0dcd18e4073454daf591e7127247e32ec942b4f3
16 changes: 12 additions & 4 deletions trunk/fs/ubifs/master.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
* @c: UBIFS file-system description object
*
* This function scans the master node LEBs and search for the latest master
* node. Returns zero in case of success and a negative error code in case of
* node. Returns zero in case of success, %-EUCLEAN if there master area is
* corrupted and requires recovery, and a negative error code in case of
* failure.
*/
static int scan_for_master(struct ubifs_info *c)
Expand All @@ -48,7 +49,7 @@ static int scan_for_master(struct ubifs_info *c)
snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node,
list);
if (snod->type != UBIFS_MST_NODE)
goto out;
goto out_dump;
memcpy(c->mst_node, snod->node, snod->len);
offs = snod->offs;
}
Expand All @@ -65,7 +66,7 @@ static int scan_for_master(struct ubifs_info *c)
goto out;
snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, list);
if (snod->type != UBIFS_MST_NODE)
goto out;
goto out_dump;
if (snod->offs != offs)
goto out;
if (memcmp((void *)c->mst_node + UBIFS_CH_SZ,
Expand All @@ -78,6 +79,12 @@ static int scan_for_master(struct ubifs_info *c)

out:
ubifs_scan_destroy(sleb);
return -EUCLEAN;

out_dump:
ubifs_err("unexpected node type %d master LEB %d:%d",
snod->type, lnum, snod->offs);
ubifs_scan_destroy(sleb);
return -EINVAL;
}

Expand Down Expand Up @@ -256,7 +263,8 @@ int ubifs_read_master(struct ubifs_info *c)

err = scan_for_master(c);
if (err) {
err = ubifs_recover_master_node(c);
if (err == -EUCLEAN)
err = ubifs_recover_master_node(c);
if (err)
/*
* Note, we do not free 'c->mst_node' here because the
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/ubifs/orphan.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ static int kill_orphans(struct ubifs_info *c)
dbg_rcvry("LEB %d", lnum);
sleb = ubifs_scan(c, lnum, 0, c->sbuf, 1);
if (IS_ERR(sleb)) {
sleb = ubifs_recover_leb(c, lnum, 0, c->sbuf, 0);
if (PTR_ERR(sleb) == -EUCLEAN)
sleb = ubifs_recover_leb(c, lnum, 0, c->sbuf, 0);
if (IS_ERR(sleb)) {
err = PTR_ERR(sleb);
break;
Expand Down

0 comments on commit 9189248

Please sign in to comment.