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  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:   Wed, 20 May 2020 12:40:50 -0700
From:   Ira Weiny <ira.weiny@...el.com>
To:     Jan Kara <jack@...e.cz>
Cc:     linux-ext4@...r.kernel.org,
        Andreas Dilger <adilger.kernel@...ger.ca>,
        "Theodore Y. Ts'o" <tytso@....edu>,
        Eric Biggers <ebiggers@...nel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        Dan Williams <dan.j.williams@...el.com>,
        Dave Chinner <david@...morbit.com>,
        Christoph Hellwig <hch@....de>, Jeff Moyer <jmoyer@...hat.com>,
        "Darrick J. Wong" <darrick.wong@...cle.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 4/8] fs/ext4: Update ext4_should_use_dax()

On Wed, May 20, 2020 at 03:37:28PM +0200, Jan Kara wrote:
> On Tue 19-05-20 22:57:49, ira.weiny@...el.com wrote:
> > From: Ira Weiny <ira.weiny@...el.com>
> > 
> > S_DAX should only be enabled when the underlying block device supports
> > dax.
> > 
> > Change ext4_should_use_dax() to check for device support prior to the
> > over riding mount option.
> > 
> > While we are at it change the function to ext4_should_enable_dax() as
> > this better reflects the ask as well as matches xfs.
> > 
> > Reviewed-by: Jan Kara <jack@...e.cz>
> > Signed-off-by: Ira Weiny <ira.weiny@...el.com>
> 
> ...
> 
> > @@ -4412,7 +4410,13 @@ static bool ext4_should_use_dax(struct inode *inode)
> >  		return false;
> >  	if (ext4_test_inode_flag(inode, EXT4_INODE_VERITY))
> >  		return false;
> > -	return true;
> > +	if (!bdev_dax_supported(inode->i_sb->s_bdev,
> > +				inode->i_sb->s_blocksize))
> > +		return false;
> > +	if (test_opt(inode->i_sb, DAX_ALWAYS))
> > +		return true;
> > +
> > +	return false;
> >  }
> 
> Now that I think about it - shouldn't we rather cache the result of
> bdev_dax_supported() in sb on mount and then just check the flag here?
> Because bdev_dax_supported() isn't exactly cheap (it does a lot of checks
> and mappings, tries to read from the pmem, ...).

Sounds reasonable.

Not sure which flags are appropriate.  So add it here?

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 1a3daf2d18ef..0b4db9ce7756 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1979,6 +1979,7 @@ static inline bool ext4_has_incompat_features(struct super_block *sb)
  */
 #define EXT4_FLAGS_RESIZING    0
 #define EXT4_FLAGS_SHUTDOWN    1
+#define EXT4_FLAGS_BDEV_IS_DAX 2
 
 static inline int ext4_forced_shutdown(struct ext4_sb_info *sbi)
 {

Powered by blists - more mailing lists