Re: [PATCH] v3 inodes are only valid on crc-enabled filesystems.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch, Leslie’s filesystem now reports a Metadata corruption as well as an invalid inode:

Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - 00:41:25: scanning agi unlinked lists - 32 of 32 allocation groups done
        - process known inodes and perform inode discovery...
        - agno = 0
...
        - agno = 29
Metadata corruption detected at block 0x9e7833810/0x2000
        - agno = 11
bad version number 0x3 on inode 124656869424
bad version number 0x3 on inode 124656869424, resetting version number
        - agno = 12
        - agno = 13
        - agno = 14
        - 00:41:26: process known inodes and inode discovery - 42368 of 42368 inodes done

—
Roger


On 16 Aug 2015, at 01:14, Roger Willcocks <roger@xxxxxxxxxxxxxxxx> wrote:

> Fix an xfs_repair regression reported by Leslie Rhorer where a bad
> (v3) inode version number was not reset.
> 
> Signed-off-by: Roger Willcocks <roger@xxxxxxxxxxxxxxxx>
> ---
> db/check.c             | 2 +-
> include/xfs_dinode.h   | 3 ++-
> libxfs/xfs_inode_buf.c | 2 +-
> repair/dinode.c        | 7 +++----
> repair/prefetch.c      | 2 +-
> 5 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/db/check.c b/db/check.c
> index c4c972f..810fa55 100644
> --- a/db/check.c
> +++ b/db/check.c
> @@ -2637,7 +2637,7 @@ process_inode(
> 		error++;
> 		return;
> 	}
> -	if (!XFS_DINODE_GOOD_VERSION(idic.di_version)) {
> +	if (!XFS_DINODE_GOOD_VERSION(&mp->m_sb, idic.di_version)) {
> 		if (isfree || v)
> 			dbprintf(_("bad version number %#x for inode %lld\n"),
> 				idic.di_version, ino);
> diff --git a/include/xfs_dinode.h b/include/xfs_dinode.h
> index 623bbe8..40700e6 100644
> --- a/include/xfs_dinode.h
> +++ b/include/xfs_dinode.h
> @@ -19,7 +19,8 @@
> #define	__XFS_DINODE_H__
> 
> #define	XFS_DINODE_MAGIC		0x494e	/* 'IN' */
> -#define XFS_DINODE_GOOD_VERSION(v)	((v) >= 1 && (v) <= 3)
> +#define XFS_DINODE_GOOD_VERSION(sb, v) \
> +	(xfs_sb_version_hascrc(sb) ? ((v) == 3) : ((v) == 1 || (v) == 2))
> 
> typedef struct xfs_timestamp {
> 	__be32		t_sec;		/* timestamp seconds */
> diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
> index de16ed9..e9cc74c 100644
> --- a/libxfs/xfs_inode_buf.c
> +++ b/libxfs/xfs_inode_buf.c
> @@ -78,7 +78,7 @@ xfs_inode_buf_verify(
> 		dip = (struct xfs_dinode *)xfs_buf_offset(bp,
> 					(i << mp->m_sb.sb_inodelog));
> 		di_ok = dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) &&
> -			    XFS_DINODE_GOOD_VERSION(dip->di_version);
> +			XFS_DINODE_GOOD_VERSION(&mp->m_sb, dip->di_version);
> 		if (unlikely(XFS_TEST_ERROR(!di_ok, mp,
> 						XFS_ERRTAG_ITOBP_INOTOBP,
> 						XFS_RANDOM_ITOBP_INOTOBP))) {
> diff --git a/repair/dinode.c b/repair/dinode.c
> index 035212c..29a7a19 100644
> --- a/repair/dinode.c
> +++ b/repair/dinode.c
> @@ -129,7 +129,7 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
> 		dinoc->di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
> 	}
> 
> -	if (!XFS_DINODE_GOOD_VERSION(dinoc->di_version) ||
> +	if (!XFS_DINODE_GOOD_VERSION(&mp->m_sb, dinoc->di_version) ||
> 	    (!fs_inode_nlink && dinoc->di_version > 1))  {
> 		__dirty_no_modify_ret(dirty);
> 		if (xfs_sb_version_hascrc(&mp->m_sb))
> @@ -2331,9 +2331,8 @@ process_dinode_int(xfs_mount_t *mp,
> 		}
> 	}
> 
> -	if (!XFS_DINODE_GOOD_VERSION(dino->di_version) ||
> -	    (!fs_inode_nlink && dino->di_version > 1) ||
> -	    (xfs_sb_version_hascrc(&mp->m_sb) && dino->di_version < 3) )  {
> +	if (!XFS_DINODE_GOOD_VERSION(&mp->m_sb, dino->di_version) ||
> +	    (!fs_inode_nlink && dino->di_version > 1) ) {
> 		retval = 1;
> 		if (!uncertain)
> 			do_warn(_("bad version number 0x%x on inode %" PRIu64 "%c"),
> diff --git a/repair/prefetch.c b/repair/prefetch.c
> index 7ea0d36..ad7082c 100644
> --- a/repair/prefetch.c
> +++ b/repair/prefetch.c
> @@ -419,7 +419,7 @@ pf_read_inode_dirs(
> 		if (be16_to_cpu(dino->di_magic) != XFS_DINODE_MAGIC)
> 			continue;
> 
> -		if (!XFS_DINODE_GOOD_VERSION(dino->di_version) ||
> +		if (!XFS_DINODE_GOOD_VERSION(&mp->m_sb, dino->di_version) ||
> 				(!fs_inode_nlink && dino->di_version > 1))
> 			continue;
> 
> -- 
> 2.5.0.rc0
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux