Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2987589ybi; Mon, 10 Jun 2019 02:13:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNBVjjFWj3Vuco+9oMf/RMwiHlbQ2PypW6V//uvKaklbBJ+5BPKPqvt5MZ1yJqhpmvjFQD X-Received: by 2002:a17:902:6b03:: with SMTP id o3mr69219115plk.85.1560158026964; Mon, 10 Jun 2019 02:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560158026; cv=none; d=google.com; s=arc-20160816; b=lX/YG8rak5fiCwzoId392KRYHEQWwqA+K8OGBce/yNe6IPR7mtaMk+04vvp8sRJ0sX /pvJG6LE4XT6pxOacU5lIKWg0rHEnM9mliq8AVI/H07Qyg+s6RdpwPu0E6WJOFl45yE/ 0dTiWPsPr9ZNA2TOPk6iFZgJiGUmg/TQPNfIidqtmjZ5+vpDuJLy8LrgPZdZy36Knonw 97hoYzhHb+ep987reF5wNHA/NKFT0PwEciJYdF8ZD4rLVnpCkFORIVam1LChsxmyHGmE IiRdV4kOhcER/iml/Qji1SAtwfk7sT9eyNN0Ch3NDqwE9ZjeazNoRLDlNyVy0GemSMzU nItg== 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=68Zy+MzCV8PC/cJJPhDJQ89EjmeWDr1fDBLYx+fbhSA=; b=UmgjBZCYp8EgT7oaqeYi1YWnQE4xmOXUhAjwMf+fi/s/OBBCyahCnh7uv8S+k6oZxc qkKKUNKlFfThV7z1JEJBQtUsI+oRuaTe1m9EBh6ujVI/Kb7g8Upuyd/IHFNnQqus0PGp D7Bh67H5IVnbT4h8aWa4ZfMpTxA0AQY0SRWXAu98CccNFy1dNwyQCxhKY1zdOI06EhLd dikcxQW/VcESu+1GdFbVl0uSZWngpnCARBJTzb93MAngLxI709rnK739Vcxyz/oROFEl 2JUa8spyN02U9RHvU7m3yHwPRr1eHZ/wb45LUCOps1MEszd4ybcnA6TbGUx4ZteoihNt Qutw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 x5si8969117pjv.62.2019.06.10.02.13.31; Mon, 10 Jun 2019 02:13:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 S2388760AbfFJJNO (ORCPT + 99 others); Mon, 10 Jun 2019 05:13:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35326 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388552AbfFJJNN (ORCPT ); Mon, 10 Jun 2019 05:13:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B23128763B; Mon, 10 Jun 2019 09:13:06 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (ovpn-116-103.sin2.redhat.com [10.67.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE25C60C68; Mon, 10 Jun 2019 09:11:47 +0000 (UTC) From: Pankaj Gupta To: dm-devel@redhat.com, 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, yuval.shaia@oracle.com, kilobyte@angband.pl, jstaron@google.com, rdunlap@infradead.org, snitzer@redhat.com, pagupta@redhat.com Subject: [PATCH v11 6/7] ext4: disable map_sync for async flush Date: Mon, 10 Jun 2019 14:37:29 +0530 Message-Id: <20190610090730.8589-7-pagupta@redhat.com> In-Reply-To: <20190610090730.8589-1-pagupta@redhat.com> References: <20190610090730.8589-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 10 Jun 2019 09:13:13 +0000 (UTC) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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 Reviewed-by: Jan Kara --- fs/ext4/file.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 98ec11f69cd4..dee549339e13 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -360,15 +360,17 @@ 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