Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp21929yba; Wed, 3 Apr 2019 03:43:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7LFYEiYF6TEj5K2fLhPNXWZV7ZBqtgwpI9SP+R5CwclCkreHJP43fgfQLdjzfAUodRbCW X-Received: by 2002:a17:902:2:: with SMTP id 2mr25905226pla.61.1554288201646; Wed, 03 Apr 2019 03:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554288201; cv=none; d=google.com; s=arc-20160816; b=u/ZYQREDtWJ92hy5/6tcTbgJg01dMM+DfsOz7CS6U8lt0QUZFJIt0/TJrv6PQJ3y8o WYGflxYQCR+222G6s6NSkPX6juxoFaVN3yxVpPbUy1rNflVkcIXqZ3IOLjrWR2QGrgOU 9BO3A8qWL/1p90Igj0M0eA5zBXEF0yRqDg7y63hPMxvvSa1FL2gAbgneG/bYJ9CqrMLv JbmQWHs/YjHt9JxGgkcFyRZpeRHmtexbxxpDYz1kMsz4a5lk7FoiuoJ18f4ZL+KR2H9B /WkrupWOvgDKM64yYcdX82mCWFqez4mGTFuGzf6+B0gIMo41/APjwc0BV0r3Z15TmtPp e4WQ== 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=LKCbSDxzeLSzA4uRnrCthew8ahUCS8viI/KI3f83bg4=; b=IvmZ2xcrZupF2CnfKC4Brz6HdlGhNgI3aPC2BNwli3ca0KtbYYUJBlL+4ZE5Ty5mf+ j0qFJQ0HPQ0BVeVXnPFVJZ1qLwVeGRHhHvit3mPx+XOIWx7frOtwRltl7rkAp7T65okx 9n7zOFvcOIRNQ40HH8PFLePfJZksMXfB6aAyuNl/X3QMPi/eI1Z5mpD+hN8PSl3iRZxH BpEym221/W7JIkTFTZiBZzweubWUHw9osajvUFEJeJgSWbcafHuqvDFL/XBUvNmRz7hN me6K+Xf7R84YH4ztfKv2kuSZEGbuPn7hnQgTlxHFsSn75S9ynw8xY23KwvLjRQAdoPa6 R0sg== 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 q1si13371591pfh.125.2019.04.03.03.43.06; Wed, 03 Apr 2019 03:43:21 -0700 (PDT) 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 S1727023AbfDCKmK (ORCPT + 99 others); Wed, 3 Apr 2019 06:42:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726444AbfDCKmK (ORCPT ); Wed, 3 Apr 2019 06:42:10 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E714A307D860; Wed, 3 Apr 2019 10:42:09 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (dhcp-10-65-161-59.pnq.redhat.com [10.65.161.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA34E19489; Wed, 3 Apr 2019 10:41:49 +0000 (UTC) From: Pankaj Gupta To: 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 Subject: [PATCH v4 4/5] ext4: disable map_sync for async flush Date: Wed, 3 Apr 2019 16:10:17 +0530 Message-Id: <20190403104018.23947-5-pagupta@redhat.com> In-Reply-To: <20190403104018.23947-1-pagupta@redhat.com> References: <20190403104018.23947-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 03 Apr 2019 10:42:10 +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 69d65d49837b..86e4bf464320 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 DAX files if + * dax_device is not synchronous. + */ + if (IS_DAX(file_inode(file)) && !dax_synchronous(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.20.1