Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp894569imu; Wed, 9 Jan 2019 08:09:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN5s1x5KgU3A/2UpgDMeDZNzAvp1dGIb+MLsTQD4Da9y/eS05gn5sYxLODZ5Wy/2XX4d3zsj X-Received: by 2002:a17:902:7443:: with SMTP id e3mr6585273plt.304.1547050148278; Wed, 09 Jan 2019 08:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547050148; cv=none; d=google.com; s=arc-20160816; b=b2D9/84ms71D8ftIFuL2EnUy3x4hrVqBhN6AdpeaKZRcCn0O+to4nMkbnzO5u7mMVz vB/Gi4fIQmrVPbV7HRvatpjR+8OdkmqYnMmGtH86IYgH1ZtEuaP/fj7lRpgfSJo+jnWj FCpAEqwHcRzYlua+nleLg+CoWwb+Q8Qwk7smHKROj8ym1QscWRnw0LVftW6xbTxeESGq Vtbd8gZ6HDROSfVVv3YMwyNmwc0OX6PMfbbfpmeumlQBYmco+EpO09kBol0HYzS2NA34 ohuz8UY+9EnCAALVkatYZTMgZfCjWGbwZjbANXkaFy8c9o6piNnY4cF0ONmptjibzp4h TcSg== 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=PZ08lSBxr601ATAwE9PkYAc0unttO9QlEh9vfgcHp2g=; b=hVIauZPrX4fEqp6I2oYvsnTZDghJvk5N9BH94rUh3YFZfBaQ7nUUj0qtufB2C5jqGu JoMMrv2iqhUddBT/95VOZesQ6WiMtlILY23oPgzovP4Fu4fJtJxA5mZLSoeYgKQjxWnr N8RAD2mPuvfib9K6QdDeg3M3KqqJOOgy8p5pUzCgy0Vq917QPZlCZYZ9Wiqrigza3HE/ Rzi+BE5B6hdM8JGl3ZKGq7wV9kRZwwxCFKNcIgSLo82wyetK3fC75O+/JEeRheRyqE6O yy+DjNzSjvgtHRJ7e1rg2bnNC9Cjvyk3NdOEyXbe5Mc5WXC44GGBR950sKuzPL7Ni+Nh BE4w== 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 d9si1743982pgb.105.2019.01.09.08.08.50; Wed, 09 Jan 2019 08:09:08 -0800 (PST) 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 S1732027AbfAIOtq (ORCPT + 99 others); Wed, 9 Jan 2019 09:49:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49270 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731755AbfAIOtp (ORCPT ); Wed, 9 Jan 2019 09:49:45 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E58EDC057E2C; Wed, 9 Jan 2019 14:49:44 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (dhcp-10-65-161-12.pnq.redhat.com [10.65.161.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8011C5D762; Wed, 9 Jan 2019 14:49:20 +0000 (UTC) From: Pankaj Gupta To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, qemu-devel@nongnu.org, linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-acpi@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Cc: jack@suse.cz, stefanha@redhat.com, dan.j.williams@intel.com, riel@surriel.com, nilal@redhat.com, kwolf@redhat.com, pbonzini@redhat.com, zwisler@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, david@redhat.com, jmoyer@redhat.com, xiaoguangrong.eric@gmail.com, hch@infradead.org, mst@redhat.com, jasowang@redhat.com, lcapitulino@redhat.com, imammedo@redhat.com, eblake@redhat.com, willy@infradead.org, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com, rjw@rjwysocki.net, pagupta@redhat.com Subject: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem Date: Wed, 9 Jan 2019 20:17:35 +0530 Message-Id: <20190109144736.17452-5-pagupta@redhat.com> In-Reply-To: <20190109144736.17452-1-pagupta@redhat.com> References: <20190109144736.17452-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 09 Jan 2019 14:49:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, 10 insertions(+), 1 deletion(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 69d65d4..e54f48b 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -360,8 +360,10 @@ 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; /* @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC)) return -EOPNOTSUPP; + /* We don't support synchronous mappings with guest direct access + * and virtio based host page cache flush mechanism. + */ + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev) + && (vma->vm_flags & VM_SYNC)) + return -EOPNOTSUPP; + file_accessed(file); if (IS_DAX(file_inode(file))) { vma->vm_ops = &ext4_dax_vm_ops; -- 2.9.3