There are times when function check_indirect_eattr saves off the value
of di_eattr in order to properly process the extended attributes.
The saved value must always be restored, if it exists, otherwise
we can accidentally remove an inode's EA reference.

rhbz#1257625
---
 gfs2/fsck/metawalk.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index dfb6c1a..6fb5c56 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1144,13 +1144,12 @@ static int check_indirect_eattr(struct gfs2_inode *ip, 
uint64_t indirect,
                }
                ea_leaf_ptr++;
        }
+       /* If we temporarily nuked the ea block to prevent checking past
+          a corrupt ea leaf, we need to restore the saved di_eattr block. */
+       if (di_eattr_save != 0)
+               ip->i_di.di_eattr = di_eattr_save;
        if (pass->finish_eattr_indir) {
                if (!first_ea_is_bad) {
-                       /* If the first ea is good but subsequent ones were
-                          bad and deleted, we need to restore the saved
-                          di_eattr block. */
-                       if (leaf_pointer_errors)
-                               ip->i_di.di_eattr = di_eattr_save;
                        pass->finish_eattr_indir(ip, leaf_pointers,
                                                 leaf_pointer_errors,
                                                 pass->private);
-- 
2.4.3

Reply via email to