Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3435050ybi; Fri, 5 Jul 2019 07:17:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxS67nQlgMP/BHPLj8fhC3a0yrL8YqhQh/g6+6nszko8yXrWbGOuhoyjzSbV8fALUfxHhDM X-Received: by 2002:a17:902:934a:: with SMTP id g10mr6124333plp.18.1562336246849; Fri, 05 Jul 2019 07:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562336246; cv=none; d=google.com; s=arc-20160816; b=QOEu6uCZrZFUsyJA9ZGuYhHg+GJ/n7hpzpcLXL0mbUu5aYsXD4IoTQQcMhttHG3eIQ 2Z6lHpX7PgGq/KvOoHQ4KQn7Rwqwz1oP1/H1CqeWVba1c/zYhZfetsnPa7j54yfru2+j cFPWQ3t5DT0lzgGZbYC7V9pwoRS0jVA/+9GviTMZ2DZW15YZWEwsogYTjekXAUolCsQb ZIWSjQ5ZflflMPXYPeTwhFtzAQvfneH6hs7iDWdXllE7oQN6iMWH1LcxD52hweEwwv8s cMtuDHOjTsmYmKNSAL/Wf1aSct+y8s69iuAV/9pIJvY0DZVgInSorwv3dgLK8ejsVFUB 6GpA== 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=uPc20v/ngbhEERuwEPdkxVQiq3V/8vN3zM/yGxW2qjSYUFJrKT5wQ518KH4BRPt+1R EOIIvifyUuhDlak3JE4FTDkEDbn1+BbH4F+c5+l9LUH+crpPk39FzHAccyMfbhl70W9y 0TktNsRnFzZacYmMetoOes3Jyu1jVNenUSk1D6iab8ma7QXo4LQWZCSRwRTmSMhzCahW oPrHVd+HpXU9ob1VSvOUxhqAyGDswNI4f0gMbJQ0MhRyzmXzvrJsRm6A9FJNelJVzb/t hxwgMYsj9Id32paBVZja68CWollBMzKJb0mopywN+6udPU+vsLHRl0WcywlEUlEnEuFl 7kSw== 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 a14si8514694pjo.40.2019.07.05.07.17.13; Fri, 05 Jul 2019 07:17:26 -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 S1726427AbfGEOKU (ORCPT + 99 others); Fri, 5 Jul 2019 10:10:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52808 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfGEOKU (ORCPT ); Fri, 5 Jul 2019 10:10:20 -0400 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 6D943308427C; Fri, 5 Jul 2019 14:10:04 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (ovpn-116-58.sin2.redhat.com [10.67.116.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29EDC860E4; Fri, 5 Jul 2019 14:09:22 +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, pagupta@redhat.com, pbonzini@redhat.com, yuval.shaia@oracle.com, kilobyte@angband.pl, jstaron@google.com, rdunlap@infradead.org, snitzer@redhat.com Subject: [PATCH v15 6/7] ext4: disable map_sync for async flush Date: Fri, 5 Jul 2019 19:33:27 +0530 Message-Id: <20190705140328.20190-7-pagupta@redhat.com> In-Reply-To: <20190705140328.20190-1-pagupta@redhat.com> References: <20190705140328.20190-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.40]); Fri, 05 Jul 2019 14:10:19 +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