diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/recovery.c | 3 | ||||
-rw-r--r-- | fs/ubifs/replay.c | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index c902a5de90ae..77e9b874b6c2 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -772,7 +772,8 @@ out_free: | |||
772 | * @sbuf: LEB-sized buffer to use | 772 | * @sbuf: LEB-sized buffer to use |
773 | * | 773 | * |
774 | * This function does a scan of a LEB, but caters for errors that might have | 774 | * This function does a scan of a LEB, but caters for errors that might have |
775 | * been caused by the unclean unmount from which we are attempting to recover. | 775 | * been caused by unclean reboots from which we are attempting to recover |
776 | * (assume that only the last log LEB can be corrupted by an unclean reboot). | ||
776 | * | 777 | * |
777 | * This function returns %0 on success and a negative error code on failure. | 778 | * This function returns %0 on success and a negative error code on failure. |
778 | */ | 779 | */ |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 730598cf6342..7df04ba4878e 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -839,6 +839,11 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
839 | if (IS_ERR(sleb)) { | 839 | if (IS_ERR(sleb)) { |
840 | if (PTR_ERR(sleb) != -EUCLEAN || !c->need_recovery) | 840 | if (PTR_ERR(sleb) != -EUCLEAN || !c->need_recovery) |
841 | return PTR_ERR(sleb); | 841 | return PTR_ERR(sleb); |
842 | /* | ||
843 | * Note, the below function will recover this log LEB only if | ||
844 | * it is the last, because unclean reboots can possibly corrupt | ||
845 | * only the tail of the log. | ||
846 | */ | ||
842 | sleb = ubifs_recover_log_leb(c, lnum, offs, sbuf); | 847 | sleb = ubifs_recover_log_leb(c, lnum, offs, sbuf); |
843 | if (IS_ERR(sleb)) | 848 | if (IS_ERR(sleb)) |
844 | return PTR_ERR(sleb); | 849 | return PTR_ERR(sleb); |
@@ -850,7 +855,6 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
850 | } | 855 | } |
851 | 856 | ||
852 | node = sleb->buf; | 857 | node = sleb->buf; |
853 | |||
854 | snod = list_entry(sleb->nodes.next, struct ubifs_scan_node, list); | 858 | snod = list_entry(sleb->nodes.next, struct ubifs_scan_node, list); |
855 | if (c->cs_sqnum == 0) { | 859 | if (c->cs_sqnum == 0) { |
856 | /* | 860 | /* |
@@ -897,7 +901,6 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
897 | } | 901 | } |
898 | 902 | ||
899 | list_for_each_entry(snod, &sleb->nodes, list) { | 903 | list_for_each_entry(snod, &sleb->nodes, list) { |
900 | |||
901 | cond_resched(); | 904 | cond_resched(); |
902 | 905 | ||
903 | if (snod->sqnum >= SQNUM_WATERMARK) { | 906 | if (snod->sqnum >= SQNUM_WATERMARK) { |
@@ -1030,9 +1033,7 @@ int ubifs_replay_journal(struct ubifs_info *c) | |||
1030 | return -ENOMEM; | 1033 | return -ENOMEM; |
1031 | 1034 | ||
1032 | dbg_mnt("start replaying the journal"); | 1035 | dbg_mnt("start replaying the journal"); |
1033 | |||
1034 | c->replaying = 1; | 1036 | c->replaying = 1; |
1035 | |||
1036 | lnum = c->ltail_lnum = c->lhead_lnum; | 1037 | lnum = c->ltail_lnum = c->lhead_lnum; |
1037 | offs = c->lhead_offs; | 1038 | offs = c->lhead_offs; |
1038 | 1039 | ||