Tommy 碎碎念

Tommy Wu's blog

« 上一篇 | 下一篇 »

xfsrestore: WARNING: corrupt extent header
post by tommy @ 14 二月, 2012 13:25

最近在還原 xfsdump 所做的備份時, 碰到幾次無法由原本的備份檔中把所有的檔案還原. 還原的過程會出現

xfsrestore: WARNING: corrupt extent header
xfsrestore: WARNING: unable to resync media file: some portion of dump

這樣的訊息. 在這訊息之後就會中斷還原 (不過最後還是回報成功).

查了一下備份時的訊息, 發現只要有出現這類的訊息, 所產生的備份檔在還原時就會出現上頭這個錯誤.

/sbin/xfsdump: WARNING: could not open regular file ino 33905028 mode
0x00008180: Stale NFS file handle: not dumped
/sbin/xfsdump: WARNING: could not get list of non-root attributes for
nondir ino 33905028: Stale NFS file handle (116)
/sbin/xfsdump: WARNING: could not get list of root attributes for
nondir ino 33905028: Stale NFS file handle (116)
/sbin/xfsdump: WARNING: could not get list of secure attributes for
nondir ino 33905028: Stale NFS file handle (116)

回報給 XFS 的 team 之後, 得到了這一個 patch:

diff --git a/dump/content.c b/dump/content.c
index 3a7f508..f915a8b 100644
--- a/dump/content.c
+++ b/dump/content.c
@@ -270,7 +270,8 @@ static rv_t dump_file_reg( drive_t *drivep,
context_t *contextp,
content_inode_hdr_t *scwhdrp,
jdm_fshandle_t *,
- xfs_bstat_t * );
+ xfs_bstat_t *,
+ bool_t *);
static rv_t dump_file_spec( drive_t *drivep,
context_t *contextp,
jdm_fshandle_t *,
@@ -3690,6 +3691,7 @@ dump_file( void *arg1,
cwhdrp->ch_specific;
startpt_t *startptp = &scwhdrp->cih_startpt;
startpt_t *endptp = &scwhdrp->cih_endpt;
+ bool_t file_skipped = BOOL_FALSE;
intgen_t state;
rv_t rv;
 
@@ -3835,7 +3837,8 @@ dump_file( void *arg1,
contextp,
scwhdrp,
fshandlep,
- statp );
+ statp,
+ &file_skipped );
if ( statp->bs_ino > contextp->cc_stat_lastino ) {
lock( );
sc_stat_nondirdone++;
@@ -3883,6 +3886,8 @@ dump_file( void *arg1,
 
if ( rv == RV_OK
&&
+ file_skipped == BOOL_FALSE
+ &&
sc_dumpextattrpr
&&
( statp->bs_xflags & XFS_XFLAG_HASATTR )) {
@@ -3903,7 +3908,8 @@ dump_file_reg( drive_t *drivep,
context_t *contextp,
content_inode_hdr_t *scwhdrp,
jdm_fshandle_t *fshandlep,
- xfs_bstat_t *statp )
+ xfs_bstat_t *statp,
+ bool_t *file_skippedp )
{
startpt_t *startptp = &scwhdrp->cih_startpt;
startpt_t *endptp = &scwhdrp->cih_endpt;
@@ -3996,6 +4002,7 @@ dump_file_reg( drive_t *drivep,
statp->bs_ino,
statp->bs_mode,
strerror( errno ));
+ *file_skippedp = BOOL_TRUE;
return RV_OK;
}
 
diff --git a/restore/content.c b/restore/content.c
index a9e0b20..a773552 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -763,6 +763,7 @@ static rv_t read_filehdr( drive_t *drivep, filehdr_t *fhdrp, bool_t fhcs );
static rv_t restore_file( drive_t *drivep,
filehdr_t *fhdrp,
bool_t ehcs,
+ bool_t ahcs,
char *path1,
char *path2 );
static bool_t restore_reg( drive_t *drivep,
@@ -3425,7 +3426,7 @@ applynondirdump( drive_t *drivep,
strctxp->sc_path[0] = '\0';
strctxp->sc_fd = -1;
 
- rv = restore_file( drivep, fhdrp, ehcs, path1, path2 );
+ rv = restore_file( drivep, fhdrp, ehcs, ahcs, path1, path2 );
 
} else if ( fhdrp->fh_flags & FILEHDR_FLAGS_EXTATTR ) {
rv = restore_extattr( drivep,
@@ -7153,6 +7154,7 @@ struct cb_context {
filehdr_t *cb_fhdrp;
rv_t cb_rv;
bool_t cb_ehcs;
+ bool_t cb_ahcs;
char *cb_path1;
char *cb_path2;
};
@@ -7165,6 +7167,7 @@ static rv_t
restore_file( drive_t *drivep,
filehdr_t *fhdrp,
bool_t ehcs,
+ bool_t ahcs,
char *path1,
char *path2 )
{
@@ -7180,6 +7183,7 @@ restore_file( drive_t *drivep,
context.cb_fhdrp = fhdrp;
context.cb_rv = RV_OK;
context.cb_ehcs = ehcs;
+ context.cb_ahcs = ahcs;
context.cb_path1 = path1;
context.cb_path2 = path2;
rv = tree_cb_links( bstatp->bs_ino,
@@ -7212,6 +7216,7 @@ restore_file_cb( void *cp, bool_t linkpr, char *path1, char *path2 )
bstat_t *bstatp = &fhdrp->fh_stat;
rv_t *rvp = &contextp->cb_rv;
bool_t ehcs = contextp->cb_ehcs;
+ bool_t ahcs = contextp->cb_ahcs;
stream_context_t *strctxp = (stream_context_t *)drivep->d_strmcontextp;
 
int rval;
@@ -7237,12 +7242,22 @@ restore_file_cb( void *cp, bool_t linkpr, char *path1, char *path2 )
ok = restore_reg( drivep, fhdrp, rvp, path1 );
if (!ok)
return ok;
- ok = restore_extent_group( drivep,
- fhdrp,
- path1,
- strctxp->sc_fd,
- ehcs,
- rvp );
+ if ( fhdrp->fh_flags & FILEHDR_FLAGS_EXTATTR ) {
+ *rvp = restore_extattr( drivep,
+ fhdrp,
+ path1,
+ ahcs,
+ BOOL_FALSE, /* isdirpr */
+ BOOL_FALSE, /* onlydoreadpr */
+ DAH_NULL );
+ } else {
+ ok = restore_extent_group( drivep,
+ fhdrp,
+ path1,
+ strctxp->sc_fd,
+ ehcs,
+ rvp );
+ }
return ok;
case S_IFBLK:
case S_IFCHR:

希望修正後不要再發生相同的情形了.

 

 

Del.icio.us Furl HEMiDEMi Technorati MyShare
迴響
暱稱:
標題:
個人網頁:
電子郵件:
迴響

  

Bad Behavior 已經阻擋了 91 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS