From patchwork Wed Jan 9 13:50:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 10754237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A763391E for ; Wed, 9 Jan 2019 14:01:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95FC328F81 for ; Wed, 9 Jan 2019 14:01:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88A9E28F83; Wed, 9 Jan 2019 14:01:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1161828F81 for ; Wed, 9 Jan 2019 14:01:05 +0000 (UTC) Received: from localhost ([127.0.0.1]:47816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghEPo-0001Fj-CK for patchwork-qemu-devel@patchwork.kernel.org; Wed, 09 Jan 2019 09:01:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghEOR-0000Cb-Qa for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:59:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghEOQ-00006J-Gi for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:59:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59756) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghEOQ-0008Ld-7a for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:59:38 -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 CD88684B0; Wed, 9 Jan 2019 13:52:47 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (dhcp-10-65-161-145.pnq.redhat.com [10.65.161.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FB48601A9; Wed, 9 Jan 2019 13:52:14 +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 Date: Wed, 9 Jan 2019 19:20:22 +0530 Message-Id: <20190109135024.14093-4-pagupta@redhat.com> In-Reply-To: <20190109135024.14093-1-pagupta@redhat.com> References: <20190109135024.14093-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.39]); Wed, 09 Jan 2019 13:52:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 3/5] libnvdimm: add nd_region buffered dax_dev flag X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pagupta@redhat.com, jack@suse.cz, david@redhat.com, jasowang@redhat.com, lcapitulino@redhat.com, adilger.kernel@dilger.ca, zwisler@kernel.org, dave.jiang@intel.com, darrick.wong@oracle.com, vishal.l.verma@intel.com, mst@redhat.com, willy@infradead.org, hch@infradead.org, jmoyer@redhat.com, nilal@redhat.com, riel@surriel.com, stefanha@redhat.com, imammedo@redhat.com, dan.j.williams@intel.com, kwolf@redhat.com, tytso@mit.edu, xiaoguangrong.eric@gmail.com, rjw@rjwysocki.net, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds 'DAXDEV_BUFFERED' flag which is set for virtio pmem corresponding nd_region. This later is used to disable MAP_SYNC functionality for ext4 & xfs filesystem. Signed-off-by: Pankaj Gupta --- drivers/dax/super.c | 17 +++++++++++++++++ drivers/nvdimm/pmem.c | 3 +++ drivers/nvdimm/region_devs.c | 7 +++++++ drivers/virtio/pmem.c | 1 + include/linux/dax.h | 9 +++++++++ include/linux/libnvdimm.h | 6 ++++++ 6 files changed, 43 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 6e928f3..9128740 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -167,6 +167,8 @@ enum dax_device_flags { DAXDEV_ALIVE, /* gate whether dax_flush() calls the low level flush routine */ DAXDEV_WRITE_CACHE, + /* flag to disable MAP_SYNC for virtio based host page cache flush */ + DAXDEV_BUFFERED, }; /** @@ -335,6 +337,21 @@ bool dax_write_cache_enabled(struct dax_device *dax_dev) } EXPORT_SYMBOL_GPL(dax_write_cache_enabled); +void virtio_pmem_host_cache(struct dax_device *dax_dev, bool wc) +{ + if (wc) + set_bit(DAXDEV_BUFFERED, &dax_dev->flags); + else + clear_bit(DAXDEV_BUFFERED, &dax_dev->flags); +} +EXPORT_SYMBOL_GPL(virtio_pmem_host_cache); + +bool virtio_pmem_host_cache_enabled(struct dax_device *dax_dev) +{ + return test_bit(DAXDEV_BUFFERED, &dax_dev->flags); +} +EXPORT_SYMBOL_GPL(virtio_pmem_host_cache_enabled); + bool dax_alive(struct dax_device *dax_dev) { lockdep_assert_held(&dax_srcu); diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index fe1217b..8d190a3 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -472,6 +472,9 @@ static int pmem_attach_disk(struct device *dev, return -ENOMEM; } dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); + + /* Set buffered bit in 'dax_dev' for virtio pmem */ + virtio_pmem_host_cache(dax_dev, nvdimm_is_buffered(nd_region)); pmem->dax_dev = dax_dev; gendev = disk_to_dev(disk); diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index f8218b4..1f8b2be 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1264,6 +1264,13 @@ int nd_region_conflict(struct nd_region *nd_region, resource_size_t start, return device_for_each_child(&nvdimm_bus->dev, &ctx, region_conflict); } +int nvdimm_is_buffered(struct nd_region *nd_region) +{ + return is_nd_pmem(&nd_region->dev) && + test_bit(ND_REGION_BUFFERED, &nd_region->flags); +} +EXPORT_SYMBOL_GPL(nvdimm_is_buffered); + void __exit nd_region_devs_exit(void) { ida_destroy(®ion_ida); diff --git a/drivers/virtio/pmem.c b/drivers/virtio/pmem.c index 51f5349..901767b 100644 --- a/drivers/virtio/pmem.c +++ b/drivers/virtio/pmem.c @@ -81,6 +81,7 @@ static int virtio_pmem_probe(struct virtio_device *vdev) ndr_desc.numa_node = nid; ndr_desc.flush = virtio_pmem_flush; set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); + set_bit(ND_REGION_BUFFERED, &ndr_desc.flags); nd_region = nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc); nd_region->provider_data = dev_to_virtio (nd_region->dev.parent->parent); diff --git a/include/linux/dax.h b/include/linux/dax.h index 0dd316a..d16e03e 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -37,6 +37,8 @@ void put_dax(struct dax_device *dax_dev); void kill_dax(struct dax_device *dax_dev); void dax_write_cache(struct dax_device *dax_dev, bool wc); bool dax_write_cache_enabled(struct dax_device *dax_dev); +void virtio_pmem_host_cache(struct dax_device *dax_dev, bool wc); +bool virtio_pmem_host_cache_enabled(struct dax_device *dax_dev); #else static inline struct dax_device *dax_get_by_host(const char *host) { @@ -64,6 +66,13 @@ static inline bool dax_write_cache_enabled(struct dax_device *dax_dev) { return false; } +static inline void virtio_pmem_host_cache(struct dax_device *dax_dev, bool wc) +{ +} +static inline bool virtio_pmem_host_cache_enabled(struct dax_device *dax_dev) +{ + return false; +} #endif struct writeback_control; diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index ca8bc07..94616f1 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -64,6 +64,11 @@ enum { */ ND_REGION_PERSIST_MEMCTRL = 2, + /* provides virtio based asynchronous flush mechanism for buffered + * host page cache. + */ + ND_REGION_BUFFERED = 3, + /* mark newly adjusted resources as requiring a label update */ DPA_RESOURCE_ADJUSTED = 1 << 0, }; @@ -265,6 +270,7 @@ int generic_nvdimm_flush(struct nd_region *nd_region); int nvdimm_has_flush(struct nd_region *nd_region); int nvdimm_has_cache(struct nd_region *nd_region); int nvdimm_in_overwrite(struct nvdimm *nvdimm); +int nvdimm_is_buffered(struct nd_region *nd_region); static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) From patchwork Wed Jan 9 13:56:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 10754223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 918EA746 for ; Wed, 9 Jan 2019 13:57:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81AA9286A0 for ; Wed, 9 Jan 2019 13:57:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7486428BC5; Wed, 9 Jan 2019 13:57:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 269E4286A0 for ; Wed, 9 Jan 2019 13:57:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:46801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghEMR-0007Gi-F3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 09 Jan 2019 08:57:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghELY-0006dp-Bn for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:56:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghELV-0005oT-Td for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:56:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39979) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghELV-0005Ty-KZ for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:56:37 -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 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) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 4/5] ext4: disable map_sync for virtio pmem X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pagupta@redhat.com, jack@suse.cz, david@redhat.com, jasowang@redhat.com, lcapitulino@redhat.com, adilger.kernel@dilger.ca, zwisler@kernel.org, dave.jiang@intel.com, darrick.wong@oracle.com, vishal.l.verma@intel.com, mst@redhat.com, willy@infradead.org, hch@infradead.org, jmoyer@redhat.com, nilal@redhat.com, riel@surriel.com, stefanha@redhat.com, imammedo@redhat.com, dan.j.williams@intel.com, kwolf@redhat.com, tytso@mit.edu, xiaoguangrong.eric@gmail.com, rjw@rjwysocki.net, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; From patchwork Wed Jan 9 13:56:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 10754227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 906D26C2 for ; Wed, 9 Jan 2019 13:59:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80ECD28F49 for ; Wed, 9 Jan 2019 13:59:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7416228F50; Wed, 9 Jan 2019 13:59:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37C8A28F49 for ; Wed, 9 Jan 2019 13:59:23 +0000 (UTC) Received: from localhost ([127.0.0.1]:47343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghEOA-0008Rm-Kk for patchwork-qemu-devel@patchwork.kernel.org; Wed, 09 Jan 2019 08:59:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghELX-0006dB-Bg for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:56:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghELV-0005oP-Sb for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:56:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18831) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghELV-0005da-Ka for qemu-devel@nongnu.org; Wed, 09 Jan 2019 08:56:37 -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 D1AA1AC600; Wed, 9 Jan 2019 13:56:29 +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 C5731600C9; Wed, 9 Jan 2019 13:56:19 +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 Date: Wed, 9 Jan 2019 19:26:06 +0530 Message-Id: <20190109135606.15401-2-pagupta@redhat.com> In-Reply-To: <20190109135606.15401-1-pagupta@redhat.com> References: <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.28]); Wed, 09 Jan 2019 13:56:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 5/5] xfs: disable map_sync for virtio pmem X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pagupta@redhat.com, jack@suse.cz, david@redhat.com, jasowang@redhat.com, lcapitulino@redhat.com, adilger.kernel@dilger.ca, zwisler@kernel.org, dave.jiang@intel.com, darrick.wong@oracle.com, vishal.l.verma@intel.com, mst@redhat.com, willy@infradead.org, hch@infradead.org, jmoyer@redhat.com, nilal@redhat.com, riel@surriel.com, stefanha@redhat.com, imammedo@redhat.com, dan.j.williams@intel.com, kwolf@redhat.com, tytso@mit.edu, xiaoguangrong.eric@gmail.com, rjw@rjwysocki.net, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Virtio pmem provides asynchronous host page cache flush mechanism. we don't support 'MAP_SYNC' with virtio pmem and xfs. Signed-off-by: Pankaj Gupta --- fs/xfs/xfs_file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index e474250..eae4aa4 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1190,6 +1190,14 @@ xfs_file_mmap( if (!IS_DAX(file_inode(filp)) && (vma->vm_flags & VM_SYNC)) return -EOPNOTSUPP; + /* We don't support synchronous mappings with guest direct access + * and virtio based host page cache mechanism. + */ + if (IS_DAX(file_inode(filp)) && virtio_pmem_host_cache_enabled( + xfs_find_daxdev_for_inode(file_inode(filp))) && + (vma->vm_flags & VM_SYNC)) + return -EOPNOTSUPP; + file_accessed(filp); vma->vm_ops = &xfs_file_vm_ops; if (IS_DAX(file_inode(filp)))