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
| ||
|
Date: Fri, 13 Nov 2015 17:06:50 -0700 From: Ross Zwisler <ross.zwisler@...ux.intel.com> To: linux-kernel@...r.kernel.org Cc: Ross Zwisler <ross.zwisler@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>, "J. Bruce Fields" <bfields@...ldses.org>, "Theodore Ts'o" <tytso@....edu>, Alexander Viro <viro@...iv.linux.org.uk>, Andreas Dilger <adilger.kernel@...ger.ca>, Dan Williams <dan.j.williams@...el.com>, Dave Chinner <david@...morbit.com>, Ingo Molnar <mingo@...hat.com>, Jan Kara <jack@...e.com>, Jeff Layton <jlayton@...chiereds.net>, Matthew Wilcox <willy@...ux.intel.com>, Thomas Gleixner <tglx@...utronix.de>, linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, linux-nvdimm@...ts.01.org, x86@...nel.org, xfs@....sgi.com, Andrew Morton <akpm@...ux-foundation.org>, Matthew Wilcox <matthew.r.wilcox@...el.com>, Dave Hansen <dave.hansen@...ux.intel.com> Subject: [PATCH v2 11/11] xfs: add support for DAX fsync/msync To properly support the new DAX fsync/msync infrastructure filesystems need to call dax_pfn_mkwrite() so that DAX can properly track when a user write faults on a previously cleaned address. They also need to call dax_fsync() in the filesystem fsync() path. This dax_fsync() call uses addresses retrieved from get_block() so it needs to be ordered with respect to truncate. This is accomplished by using the same locking that was set up for DAX page faults. Signed-off-by: Ross Zwisler <ross.zwisler@...ux.intel.com> --- fs/xfs/xfs_file.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 39743ef..2b490a1 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -209,7 +209,8 @@ xfs_file_fsync( loff_t end, int datasync) { - struct inode *inode = file->f_mapping->host; + struct address_space *mapping = file->f_mapping; + struct inode *inode = mapping->host; struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; int error = 0; @@ -218,7 +219,13 @@ xfs_file_fsync( trace_xfs_file_fsync(ip); - error = filemap_write_and_wait_range(inode->i_mapping, start, end); + if (dax_mapping(mapping)) { + xfs_ilock(XFS_I(inode), XFS_MMAPLOCK_SHARED); + dax_fsync(mapping, start, end); + xfs_iunlock(XFS_I(inode), XFS_MMAPLOCK_SHARED); + } + + error = filemap_write_and_wait_range(mapping, start, end); if (error) return error; @@ -1603,9 +1610,8 @@ xfs_filemap_pmd_fault( /* * pfn_mkwrite was originally inteneded to ensure we capture time stamp * updates on write faults. In reality, it's need to serialise against - * truncate similar to page_mkwrite. Hence we open-code dax_pfn_mkwrite() - * here and cycle the XFS_MMAPLOCK_SHARED to ensure we serialise the fault - * barrier in place. + * truncate similar to page_mkwrite. Hence we cycle the XFS_MMAPLOCK_SHARED + * to ensure we serialise the fault barrier in place. */ static int xfs_filemap_pfn_mkwrite( @@ -1628,6 +1634,8 @@ xfs_filemap_pfn_mkwrite( size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; if (vmf->pgoff >= size) ret = VM_FAULT_SIGBUS; + else if (IS_DAX(inode)) + ret = dax_pfn_mkwrite(vma, vmf); xfs_iunlock(ip, XFS_MMAPLOCK_SHARED); sb_end_pagefault(inode->i_sb); return ret; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists