Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f4a2a97 authored by Mark Fasheh's avatar Mark Fasheh
Browse files

ocfs2: always unmap in ocfs2_data_convert_worker()



Mmap-heavy clustered workloads were sometimes finding stale data on mmap
reads. The solution is to call unmap_mapping_range() on any down convert of
a data lock.

Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 6c2aad05
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -2718,6 +2718,15 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
       	inode = ocfs2_lock_res_inode(lockres);
       	inode = ocfs2_lock_res_inode(lockres);
	mapping = inode->i_mapping;
	mapping = inode->i_mapping;


	/*
	 * We need this before the filemap_fdatawrite() so that it can
	 * transfer the dirty bit from the PTE to the
	 * page. Unfortunately this means that even for EX->PR
	 * downconverts, we'll lose our mappings and have to build
	 * them up again.
	 */
	unmap_mapping_range(mapping, 0, 0, 0);

	if (filemap_fdatawrite(mapping)) {
	if (filemap_fdatawrite(mapping)) {
		mlog(ML_ERROR, "Could not sync inode %llu for downconvert!",
		mlog(ML_ERROR, "Could not sync inode %llu for downconvert!",
		     (unsigned long long)OCFS2_I(inode)->ip_blkno);
		     (unsigned long long)OCFS2_I(inode)->ip_blkno);
@@ -2725,7 +2734,6 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
	sync_mapping_buffers(mapping);
	sync_mapping_buffers(mapping);
	if (blocking == LKM_EXMODE) {
	if (blocking == LKM_EXMODE) {
		truncate_inode_pages(mapping, 0);
		truncate_inode_pages(mapping, 0);
		unmap_mapping_range(mapping, 0, 0, 0);
	} else {
	} else {
		/* We only need to wait on the I/O if we're not also
		/* We only need to wait on the I/O if we're not also
		 * truncating pages because truncate_inode_pages waits
		 * truncating pages because truncate_inode_pages waits