diff mbox

[11/10] xfs_repair: clear extent size hints when clearing inode core

Message ID 20180628172937.GI5711@magnolia (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong June 28, 2018, 5:29 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

In kernel 4.18 we become more strict about what can be in the extent
size hint fields, even for freed inodes.  Therefore, if repair decides
to clear out an inode core, zero the hint fields and clear the flags so
that the kernel won't trip over the cleared inode if and when it tries
to read the chunk.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/dinode.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Sandeen June 28, 2018, 7:24 p.m. UTC | #1
On 6/28/18 12:29 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> In kernel 4.18 we become more strict about what can be in the extent
> size hint fields, even for freed inodes.  Therefore, if repair decides
> to clear out an inode core, zero the hint fields and clear the flags so
> that the kernel won't trip over the cleared inode if and when it tries
> to read the chunk.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good, I'll merge this before the libxfs sync.  Thanks!

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  repair/dinode.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/repair/dinode.c b/repair/dinode.c
> index f9b2bac0..4118db7c 100644
> --- a/repair/dinode.c
> +++ b/repair/dinode.c
> @@ -194,6 +194,11 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
>  		dinoc->di_anextents = 0;
>  	}
>  
> +	if (be32_to_cpu(dinoc->di_extsize) != 0)  {
> +		__dirty_no_modify_ret(dirty);
> +		dinoc->di_extsize = 0;
> +	}
> +
>  	if (dinoc->di_version > 1 &&
>  			be32_to_cpu(dinoc->di_nlink) != 0)  {
>  		__dirty_no_modify_ret(dirty);
> @@ -237,6 +242,11 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
>  		dinoc->di_changecount = 0;
>  	}
>  
> +	if (be32_to_cpu(dinoc->di_cowextsize) != 0)  {
> +		__dirty_no_modify_ret(dirty);
> +		dinoc->di_cowextsize = 0;
> +	}
> +
>  	return dirty;
>  }
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/repair/dinode.c b/repair/dinode.c
index f9b2bac0..4118db7c 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -194,6 +194,11 @@  clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
 		dinoc->di_anextents = 0;
 	}
 
+	if (be32_to_cpu(dinoc->di_extsize) != 0)  {
+		__dirty_no_modify_ret(dirty);
+		dinoc->di_extsize = 0;
+	}
+
 	if (dinoc->di_version > 1 &&
 			be32_to_cpu(dinoc->di_nlink) != 0)  {
 		__dirty_no_modify_ret(dirty);
@@ -237,6 +242,11 @@  clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)
 		dinoc->di_changecount = 0;
 	}
 
+	if (be32_to_cpu(dinoc->di_cowextsize) != 0)  {
+		__dirty_no_modify_ret(dirty);
+		dinoc->di_cowextsize = 0;
+	}
+
 	return dirty;
 }