Re: [man-pages RFC PATCH v4] statx, inode: document the new STATX_INO_VERSION field

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

 



On Thu 08-09-22 10:44:22, NeilBrown wrote:
> On Wed, 07 Sep 2022, Jan Kara wrote:
> > On Wed 07-09-22 09:12:34, Jeff Layton wrote:
> > > On Wed, 2022-09-07 at 08:52 -0400, J. Bruce Fields wrote:
> > > > On Wed, Sep 07, 2022 at 08:47:20AM -0400, Jeff Layton wrote:
> > > > > On Wed, 2022-09-07 at 21:37 +1000, NeilBrown wrote:
> > > > > > On Wed, 07 Sep 2022, Jeff Layton wrote:
> > > > > > > +The change to \fIstatx.stx_ino_version\fP is not atomic with respect to the
> > > > > > > +other changes in the inode. On a write, for instance, the i_version it usually
> > > > > > > +incremented before the data is copied into the pagecache. Therefore it is
> > > > > > > +possible to see a new i_version value while a read still shows the old data.
> > > > > > 
> > > > > > Doesn't that make the value useless?
> > > > > > 
> > > > > 
> > > > > No, I don't think so. It's only really useful for comparing to an older
> > > > > sample anyway. If you do "statx; read; statx" and the value hasn't
> > > > > changed, then you know that things are stable. 
> > > > 
> > > > I don't see how that helps.  It's still possible to get:
> > > > 
> > > > 		reader		writer
> > > > 		------		------
> > > > 				i_version++
> > > > 		statx
> > > > 		read
> > > > 		statx
> > > > 				update page cache
> > > > 
> > > > right?
> > > > 
> > > 
> > > Yeah, I suppose so -- the statx wouldn't necessitate any locking. In
> > > that case, maybe this is useless then other than for testing purposes
> > > and userland NFS servers.
> > > 
> > > Would it be better to not consume a statx field with this if so? What
> > > could we use as an alternate interface? ioctl? Some sort of global
> > > virtual xattr? It does need to be something per-inode.
> > 
> > I was thinking how hard would it be to increment i_version after updating
> > data but it will be rather hairy. In particular because of stuff like
> > IOCB_NOWAIT support which needs to bail if i_version update is needed. So
> > yeah, I don't think there's an easy way how to provide useful i_version for
> > general purpose use.
> > 
> 
> Why cannot IOCB_NOWAIT update i_version?  Do we not want to wait on the
> cmp_xchg loop in inode_maybe_inc_iversion(), or do we not want to
> trigger an inode update?
> 
> The first seems unlikely, but the second seems unreasonable.  We already
> acknowledge that after a crash iversion might go backwards and/or miss
> changes.

It boils down to the fact that we don't want to call mark_inode_dirty()
from IOCB_NOWAIT path because for lots of filesystems that means journal
operation and there are high chances that may block.

Presumably we could treat inode dirtying after i_version change similarly
to how we handle timestamp updates with lazytime mount option (i.e., not
dirty the inode immediately but only with a delay) but then the time window
for i_version inconsistencies due to a crash would be much larger.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux