Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp230071yba; Thu, 25 Apr 2019 22:04:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqywao28rT2bANTZBlx7aMjggl58xNJju/T2YT36rAxVKdR3ryAF+MlY749li9CATuza3h+U X-Received: by 2002:a63:155d:: with SMTP id 29mr41183738pgv.389.1556255091116; Thu, 25 Apr 2019 22:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556255091; cv=none; d=google.com; s=arc-20160816; b=QWw/bJTQ4L7tJ5QuHt383VR0LIwk5DNnepMQkXwVlDHlQoD9TG1znTLAhLoZrrd4GJ s/dvroipX2s6L9qOsA0aQHOxfSXsYCZgEPlPKaRjDvTSe6y9JlLCBBwjIriNQ38OaFJW fcwTMbESaylTwqItNbJw6JxOpsQ963yXPO2ta6IP3wIwUImaZgCKj0DIOQaTvt9sDUfG XO2WdthuIOiOSFO74UjSrSgQQhOfv/UMqx87DrqVCe1PYIG98ZPNdwePCpMvKQ8rjdoI hWFDAIaYWNt9LSJxxujrLBUKiEZ2GPeAJpbF/vs16WI5tUNwkv5iG8m/hAszb+KHHZoY carg== 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=p6McCdY+B1Bu33Yu5G/m+DvfstL9RAkvEfr7kdeCAc+K6uUsJkJRvD82455KKREzBr dOb7gVIEJbk3R0XmnOtcOHQMrMtkW9gxhry1co7CElVSyT8EE1cKNBQThiN9ZIbEe2Qh S6qPjUlGgKyIXJ8tQKc680iVEeko8Cq3egzion2gsVmqMti/2NqcepK23Fch4Pw6ku5y DOXtycfelbBG0DGbnw4DsZuSA+ftft6ZB4FUP2tyxG/KHbvoTzSn0Ne+pokeGKmbohao Fi1rpyW+PzBgN8tAIJVRBIdh8BNdDsJgr+iavkX3kQjJFanqNQgP7XuzdTtiubQGYXom DAXA== 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 f15si17589253pga.358.2019.04.25.22.04.35; Thu, 25 Apr 2019 22:04:51 -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 S1725953AbfDZFCv (ORCPT + 99 others); Fri, 26 Apr 2019 01:02:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34964 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbfDZFCv (ORCPT ); Fri, 26 Apr 2019 01:02:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37134307D90E; Fri, 26 Apr 2019 05:02:51 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (unknown [10.65.16.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 467A260856; Fri, 26 Apr 2019 05:02:32 +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, pbonzini@redhat.com, kilobyte@angband.pl, yuval.shaia@oracle.com, pagupta@redhat.com Subject: [PATCH v7 5/6] ext4: disable map_sync for async flush Date: Fri, 26 Apr 2019 10:30:38 +0530 Message-Id: <20190426050039.17460-6-pagupta@redhat.com> In-Reply-To: <20190426050039.17460-1-pagupta@redhat.com> References: <20190426050039.17460-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 26 Apr 2019 05:02:51 +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