Skip to content

Commit 2c0cd5a

Browse files
amissael95Atsushi Abe
authored andcommitted
Changed skip flags when calling _ltfs_search_index_wp (#493)
1 parent 29b6f34 commit 2c0cd5a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/libltfs/ltfs.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,8 @@ int ltfs_mount(bool force_full, bool deep_recovery, bool recover_extra, bool rec
16731673
(unsigned long long)vol->dp_coh.volume_change_ref,
16741674
(unsigned long long)volume_change_ref);
16751675

1676-
ret = _ltfs_search_index_wp(recover_symlink, false, &seekpos, vol);
1676+
/* Index of IP could be corrupted. So set skip flag to true */
1677+
ret = _ltfs_search_index_wp(recover_symlink, true, &seekpos, vol);
16771678
if (ret < 0)
16781679
goto out_unlock;
16791680

@@ -1683,7 +1684,7 @@ int ltfs_mount(bool force_full, bool deep_recovery, bool recover_extra, bool rec
16831684
seekpos.block = vol->dp_coh.set_id;
16841685
}
16851686
} else {
1686-
if (vollock != PWE_MAM_DP && vollock != PWE_MAM) {
1687+
if (vol->ip_coh.count > vol->dp_coh.count && vollock != PWE_MAM_DP && vollock != PWE_MAM) {
16871688
/*
16881689
* The index on IP is newer but MAM shows write perm doesn't happen in DP.
16891690
* LTFS already have written an index on DP when it is writing an index on IP,
@@ -1702,8 +1703,13 @@ int ltfs_mount(bool force_full, bool deep_recovery, bool recover_extra, bool rec
17021703
(unsigned long long)vol->dp_coh.volume_change_ref,
17031704
(unsigned long long)volume_change_ref);
17041705

1705-
/* Index of IP could be corrupted. So set skip flag */
1706-
ret = _ltfs_search_index_wp(recover_symlink, true, &seekpos, vol);
1706+
if (vollock == PWE_MAM_BOTH) {
1707+
/* Index of IP could be corrupted (because of double write perm). So set skip flag to true */
1708+
ret = _ltfs_search_index_wp(recover_symlink, true, &seekpos, vol);
1709+
} else {
1710+
/* Index of DP could be corrupted. So set skip flag to false */
1711+
ret = _ltfs_search_index_wp(recover_symlink, false, &seekpos, vol);
1712+
}
17071713
if (ret < 0)
17081714
goto out_unlock;
17091715

0 commit comments

Comments
 (0)