Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp785506imu; Wed, 9 Jan 2019 06:23:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6uvYBaOU4LXq8dzH/hspt3/dRenjo9iTI4YDvKbDGSBTBuJglQxMqYDwArkY+hVvKCVvLe X-Received: by 2002:a17:902:1d4a:: with SMTP id u10mr5975267plu.122.1547043832415; Wed, 09 Jan 2019 06:23:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547043832; cv=none; d=google.com; s=arc-20160816; b=xc5nhNY2S26EXUxSbCScMz4vXCcNlMN8a0YAgVebz7xKlhdE/4vRbv7JxxJqcgZQWY JbQdW6IG9/nvp2Zl7dibvVbPE1uuuspvnmQcp17upchgm+QjkiXQzJ/mkfFTW3dNAMWh rpwqf8fAdnJeBReQn5WfzjtHtGzKbKZ5Q05VyAuB3KiWSdic44mBWkYB6g8ObkaBdqCX BBp/JNwJ48YayZe9xfLA9hYdayDQqdbSL78XF9GYtBVGHK2rTrocaGwGk9F7QdNt2NMW 3encwZsSQMpNh0pmRjlbN6MFe2skI9nuwnMgQ118rNj5ae6PoI5SQORXD4oHOMndi3fu w7GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=PZ08lSBxr601ATAwE9PkYAc0unttO9QlEh9vfgcHp2g=; b=bgtEgydXC7T4Oaaxyz7Fz+d6dxwKgtiVFrIIa+k4nGE92P/OYz35v1NFrBkP+dvorw SmuRTCvqDtpQ65uHM6z/4SSEGPC1zw1jYbVmSKT8hnGao5Oz4Zk8/Z1jOOB+Z6XJHfNM lLx0LmJ+Atqzn1xWIfzmfSy7AyCXpGP5stZaqWCUYA5MaZhUVq85J+5eDJOCGcWk9q72 wUAdPgi/xfA7bjS23HamGyyDjUH1P0nETi5L+vVvc1MpH4Se3bz/XNRPSkFKIgs0NCb1 PpnXF07paOuyM5iPFfx+oghQ95XcFE4kRoUpKp6npuAMUFQBUX+mmtTXZNXIeotgbNgW RytQ== 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 p1si22785905pgb.192.2019.01.09.06.23.36; Wed, 09 Jan 2019 06:23:52 -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 S1730912AbfAIN4X (ORCPT + 99 others); Wed, 9 Jan 2019 08:56:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47106 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730593AbfAIN4W (ORCPT ); Wed, 9 Jan 2019 08:56:22 -0500 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 9714A7970F; Wed, 9 Jan 2019 13:56:19 +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 60FB063F90; Wed, 9 Jan 2019 13:56:08 +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 19:26:05 +0530 Message-Id: <20190109135606.15401-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.25]); Wed, 09 Jan 2019 13:56:21 +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