xfs
[Top] [All Lists]

[PATCH v2 3/3] xfs_repair: include any realloc'ed buffers in final putbu

To: <xfs@xxxxxxxxxxx>
Subject: [PATCH v2 3/3] xfs_repair: include any realloc'ed buffers in final putbuf
From: Mike Grant <mggr@xxxxxxxxx>
Date: Fri, 19 Jun 2015 16:04:01 +0100
Cc: Mike Grant <mggr@xxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1434726241-11606-1-git-send-email-mggr@xxxxxxxxx>
References: <1434726241-11606-1-git-send-email-mggr@xxxxxxxxx>
The realloc code included in commit 95dff16b1 potentially introduces
extra buffers to bplist.  These should be dealt with at the end of the
longform_dir2_entry_check function.  This replaces the originally estimated
number of entries (freetab->naents) with the actual number finally allocated
(num_bps).

Note: this has not been tested on a suitable filesystem image but
appears correct..

Signed-off-by: Mike Grant <mggr@xxxxxxxxx>
---
 repair/phase6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/repair/phase6.c b/repair/phase6.c
index e24cf62..7f7d9b0 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -2409,14 +2409,14 @@ longform_dir2_entry_check(xfs_mount_t   *mp,
 out_fix:
        if (!no_modify && (fixit || dotdot_update)) {
                dir_hash_dup_names(hashtab);
-               for (i = 0; i < freetab->naents; i++)
+               for (i = 0; i < num_bps; i++)
                        if (bplist[i])
                                libxfs_putbuf(bplist[i]);
                longform_dir2_rebuild(mp, ino, ip, irec, ino_offset, hashtab);
                *num_illegal = 0;
                *need_dot = 0;
        } else {
-               for (i = 0; i < freetab->naents; i++)
+               for (i = 0; i < num_bps; i++)
                        if (bplist[i])
                                libxfs_putbuf(bplist[i]);
        }
-- 
2.1.0

(apologies for the following junk forcibly appended by my company)


Please visit our new website at www.pml.ac.uk and follow us on Twitter  
@PlymouthMarine

Winner of the Environment & Conservation category, the Charity Awards 2014.

Plymouth Marine Laboratory (PML) is a company limited by guarantee registered 
in England & Wales, company number 4178503. Registered Charity No. 1091222. 
Registered Office: Prospect Place, The Hoe, Plymouth  PL1 3DH, UK. 

This message is private and confidential. If you have received this message in 
error, please notify the sender and remove it from your system. You are 
reminded that e-mail communications are not secure and may contain viruses; PML 
accepts no liability for any loss or damage which may be caused by viruses.

<Prev in Thread] Current Thread [Next in Thread>