[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230512033143.GM858815@frogsfrogsfrogs>
Date: Thu, 11 May 2023 20:31:43 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: "renlei1@...natelecom.cn" <renlei1@...natelecom.cn>
Cc: Dave Chinner <david@...morbit.com>,
linux-xfs <linux-xfs@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Re: [PATCH] xfs: xfs_nfs_get_inode support zero generation
On Fri, May 12, 2023 at 10:53:29AM +0800, renlei1@...natelecom.cn wrote:
> Yup, gen is 0 for the inodes created by libxfs, such as rootino, rbmino, rsumino.
> but those inodes will never be freed, and gen will always zero.
> so I think bypass the verification if gen==0 is still valid.
I disagree. Handles have long encoded inode and generation to prevent
users from unintentionally modifying a file when the inode number is
recycled as a result of an unlink/create cycle.
--D
> Regards,
> Lei
>
> From: Dave Chinner
> Date: 2023-05-12 10:00
> To: Darrick J. Wong
> CC: renlei1; linux-xfs; linux-kernel
> Subject: Re: [PATCH] xfs: xfs_nfs_get_inode support zero generation
> On Thu, May 11, 2023 at 04:22:06PM -0700, Darrick J. Wong wrote:
> > On Thu, May 11, 2023 at 06:17:21PM +0800, renlei1@...natelecom.cn wrote:
> > > From: Ren Lei <renlei1@...natelecom.cn>
> > >
> > > If generation is zero, bypass the verification of generation number
> > > to avoid stale file error. (Be consistent with other fs, such as
> > > ext4, fat, jfs, etc.)
> >
> > What code is affected by the gen==0 handles being rejected? Is there a
> > user program or test case where this is required?
>
> A generation number of 0 is perfectly valid in XFS. We've been
> creating them in XFS filesystems since 1993 and never had a problem
> with filehandle verification. Indeed, every root inode in every XFS
> filesystem ever made will have a generation number of 0.
>
> Yup, a random XFS filesystem recently made from a current xfsprogs:
>
> # xfs_db /dev/vdc
> xfs_db> sb 0
> xfs_db> a rootino
> xfs_db> p core.gen
> core.gen = 0
> xfs_db>
>
> -Dave.
> --
> Dave Chinner
> david@...morbit.com
>
Powered by blists - more mailing lists