Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4496233yba; Tue, 9 Apr 2019 21:32:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKS0T7iC0rt9vyAcYHQoS4QynhZ2ACUfTVWsTQsxtRZQq1K+SAd0Rh0CeJPF0L8HD+QHeB X-Received: by 2002:a63:750c:: with SMTP id q12mr39427040pgc.133.1554870745759; Tue, 09 Apr 2019 21:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554870745; cv=none; d=google.com; s=arc-20160816; b=IYk6dMArsSaM98UzrMORO6PHBtVVllEbS2b8xBFLCTXDacjQvvm7JPSMNLq+9B0PBL 87j9sbN2GDf1Xo+0tkVEgEvXcvpNCVrR+S6Tx0PIwNMLfsplhTBbFKw33qoS1btLMKzI k4R47aZzw/wjhpzeY1xYlPuQCtb9Lfz0/KbqZMiEbjwhw/xYxzhtd6BfCGUKpwzXYIzw z39wv0B5oE1DJUhaobFP5GUxAy6YlfWIzkn1ZUc9zoiofkMBAfzdxPwpB9yij/sg2Aim 1j3hynkcp+Y6cwaUVEOswvWQtDeUu+QOumqOTISLWLBIidKo0AFjrtcTKM/I0QYDf0lZ BKmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=h23/3GGaoBRVhIzrQQhiPtyuMQXq8rhBq7ECW28Y8Qk=; b=OIhbSbkfXEuSE3IBtIUizKM3R/wmLD1VCAy9+YKLpnq4DxrWLYbmBb3tEYWumoHVJd NdUHvLeLrDMWhG4o61FJooE9WHt1PZ0pyvEIjZRRU5F52KGXpw6sOnpLKVVxZWGlMALS RSReaMGEaT2bjHgS0e/9q7JWbPhSiDkvmmMu23zZqwMyVaeLR9yV7r84ILMq9HqvCXzX lFDBzyroRUkOUa2OTNOsLvuq/Sqk0uyrQe0tWyLp2IIWPk1EpG9mbAw6yrBtqN4fcyJW LnTIM5qwaoE1x2HzifOeJPUwz9iMJFiSH/jLzqM+DtNIsn89HExXSokuB9vdaYll+Q/9 9b0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13si31207928pga.331.2019.04.09.21.32.09; Tue, 09 Apr 2019 21:32:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727320AbfDJEK4 (ORCPT + 99 others); Wed, 10 Apr 2019 00:10:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49366 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726925AbfDJEKz (ORCPT ); Wed, 10 Apr 2019 00:10:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7FC763082E4C; Wed, 10 Apr 2019 04:10:55 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (dhcp-10-65-161-59.pnq.redhat.com [10.65.161.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61AAC64280; Wed, 10 Apr 2019 04:10:29 +0000 (UTC) From: Pankaj Gupta To: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-acpi@vger.kernel.org, qemu-devel@nongnu.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Cc: dan.j.williams@intel.com, zwisler@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, mst@redhat.com, jasowang@redhat.com, willy@infradead.org, rjw@rjwysocki.net, hch@infradead.org, lenb@kernel.org, jack@suse.cz, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com, lcapitulino@redhat.com, kwolf@redhat.com, imammedo@redhat.com, jmoyer@redhat.com, nilal@redhat.com, riel@surriel.com, stefanha@redhat.com, aarcange@redhat.com, david@redhat.com, david@fromorbit.com, cohuck@redhat.com, xiaoguangrong.eric@gmail.com, pbonzini@redhat.com, kilobyte@angband.pl, yuval.shaia@oracle.com, pagupta@redhat.com Subject: [PATCH v5 5/6] ext4: disable map_sync for async flush Date: Wed, 10 Apr 2019 09:38:25 +0530 Message-Id: <20190410040826.24371-6-pagupta@redhat.com> In-Reply-To: <20190410040826.24371-1-pagupta@redhat.com> References: <20190410040826.24371-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 10 Apr 2019 04:10:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dont support 'MAP_SYNC' with non-DAX files and DAX files with asynchronous dax_device. Virtio pmem provides asynchronous host page cache flush mechanism. We don't support 'MAP_SYNC' with virtio pmem and ext4. Signed-off-by: Pankaj Gupta --- fs/ext4/file.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 69d65d49837b..4b2ccaf1932e 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -360,15 +360,16 @@ static const struct vm_operations_struct ext4_file_vm_ops = { static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) { struct inode *inode = file->f_mapping->host; + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); + struct dax_device *dax_dev = sbi->s_daxdev; - if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) + if (unlikely(ext4_forced_shutdown(sbi))) return -EIO; - /* - * We don't support synchronous mappings for non-DAX files. At least - * until someone comes with a sensible use case. + /* We don't support synchronous mappings for non-DAX files and + * for DAX files if underneath dax_device is not synchronous. */ - if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC)) + if (!daxdev_mapping_supported(vma, dax_dev)) return -EOPNOTSUPP; file_accessed(file); -- 2.20.1