lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Apr 2020 21:07:33 -0700
From:   Ira Weiny <ira.weiny@...el.com>
To:     "Darrick J. Wong" <darrick.wong@...cle.com>
Cc:     linux-kernel@...r.kernel.org,
        Dan Williams <dan.j.williams@...el.com>,
        Dave Chinner <david@...morbit.com>,
        Christoph Hellwig <hch@....de>,
        "Theodore Y. Ts'o" <tytso@....edu>, Jan Kara <jack@...e.cz>,
        Jeff Moyer <jmoyer@...hat.com>, linux-ext4@...r.kernel.org,
        linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH V7 6/9] fs/xfs: Combine xfs_diflags_to_linux() and
 xfs_diflags_to_iflags()

On Mon, Apr 13, 2020 at 09:01:38AM -0700, Darrick J. Wong wrote:
> On Sun, Apr 12, 2020 at 10:40:43PM -0700, ira.weiny@...el.com wrote:

[snip]

> >  
> > -STATIC void
> > +void
> >  xfs_diflags_to_iflags(
> > -	struct inode		*inode,
> > -	struct xfs_inode	*ip)
> > +	struct xfs_inode	*ip,
> > +	bool init)
> >  {
> > -	uint16_t		flags = ip->i_d.di_flags;
> > -
> > -	inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_SYNC |
> > -			    S_NOATIME | S_DAX);
> > -
> > -	if (flags & XFS_DIFLAG_IMMUTABLE)
> > -		inode->i_flags |= S_IMMUTABLE;
> > -	if (flags & XFS_DIFLAG_APPEND)
> > -		inode->i_flags |= S_APPEND;
> > -	if (flags & XFS_DIFLAG_SYNC)
> > -		inode->i_flags |= S_SYNC;
> > -	if (flags & XFS_DIFLAG_NOATIME)
> > -		inode->i_flags |= S_NOATIME;
> > -	if (xfs_inode_enable_dax(ip))
> > -		inode->i_flags |= S_DAX;
> > +	struct inode            *inode = VFS_I(ip);
> > +	unsigned int            xflags = xfs_ip2xflags(ip);
> > +	unsigned int            flags = 0;
> > +
> > +	ASSERT(!(IS_DAX(inode) && init));
> > +
> > +	if (xflags & FS_XFLAG_IMMUTABLE)
> > +		flags |= S_IMMUTABLE;
> > +	if (xflags & FS_XFLAG_APPEND)
> > +		flags |= S_APPEND;
> > +	if (xflags & FS_XFLAG_SYNC)
> > +		flags |= S_SYNC;
> > +	if (xflags & FS_XFLAG_NOATIME)
> > +		flags |= S_NOATIME;
> > +	if (init && xfs_inode_enable_dax(ip))
> > +		flags |= S_DAX;
> > +
> > +	inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_SYNC | S_NOATIME);
> 
> I noticed that S_DAX drops out of the mask out operation here, which of
> course resulted in an eyebrow-raise because the other four flags are
> always set to whatever we just computed. :)
> 
> Then I realized that yes, this is intentional since we can't change
> S_DAX on the fly, and that S_DAX is never set i_flags on an inode that's
> being initialized so we don't need to mask off S_DAX ever.
> 
> Could we add a comment here to remind the reader that S_DAX is a bit
> special?
> 
> /*
>  * S_DAX can only be set during inode initialization and is never set by
>  * the VFS, so we cannot mask off S_DAX in i_flags.
>  */
> 
> With that added,
> Reviewed-by: Darrick J. Wong <darrick.wong@...cle.com>

Added that comment.

Thanks for the review!
Ira

> 
> --D

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ