On Wed, Mar 24, 2021 at 03:21:13PM +0100, Christoph Hellwig wrote:
> Make sure di_flags2 is always initialized. We currently get this implicitly
> by clearing the dinode core on allocating the in-core inode, but that is
> about to go away.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Hrmm, new_diflags2 is zero on V4 filesystems, so this looks ok.
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>
--D
> ---
> fs/xfs/xfs_icache.c | 1 +
> fs/xfs/xfs_inode.c | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index 266fb77ac5608c..0e43d27e8e13bc 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -64,6 +64,7 @@ xfs_inode_alloc(
> ip->i_flags = 0;
> ip->i_delayed_blks = 0;
> memset(&ip->i_d, 0, sizeof(ip->i_d));
> + ip->i_d.di_flags2 = mp->m_ino_geo.new_diflags2;
> ip->i_sick = 0;
> ip->i_checked = 0;
> INIT_WORK(&ip->i_ioend_work, xfs_end_io);
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 3fa332a1d24f9f..093689996f06f3 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -845,7 +845,6 @@ xfs_init_new_inode(
>
> if (xfs_sb_version_has_v3inode(&mp->m_sb)) {
> inode_set_iversion(inode, 1);
> - ip->i_d.di_flags2 = mp->m_ino_geo.new_diflags2;
> ip->i_d.di_cowextsize = 0;
> ip->i_d.di_crtime = tv;
> }
> --
> 2.30.1
>