From patchwork Tue Nov 14 19:56:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10058271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5D203601D3 for ; Tue, 14 Nov 2017 20:13:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5258D237A5 for ; Tue, 14 Nov 2017 20:13:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 466E429972; Tue, 14 Nov 2017 20:13:41 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D051629969 for ; Tue, 14 Nov 2017 20:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755554AbdKNUKW (ORCPT ); Tue, 14 Nov 2017 15:10:22 -0500 Received: from mga01.intel.com ([192.55.52.88]:39999 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755465AbdKNUEz (ORCPT ); Tue, 14 Nov 2017 15:04:55 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 12:04:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,396,1505804400"; d="scan'208";a="4947448" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga001.jf.intel.com with ESMTP; 14 Nov 2017 12:04:54 -0800 Subject: [PATCH v2 2/4] mm: fail get_vaddr_frames() for filesystem-dax mappings From: Dan Williams To: akpm@linux-foundation.org Cc: Jan Kara , Joonyoung Shim , linux-nvdimm@lists.01.org, Seung-Woo Kim , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Inki Dae , linux-mm@kvack.org, Kyungmin Park , Mel Gorman , Mauro Carvalho Chehab , Vlastimil Babka , linux-media@vger.kernel.org Date: Tue, 14 Nov 2017 11:56:39 -0800 Message-ID: <151068939985.7446.15684639617389154187.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <151068938905.7446.12333914805308312313.stgit@dwillia2-desk3.amr.corp.intel.com> References: <151068938905.7446.12333914805308312313.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Until there is a solution to the dma-to-dax vs truncate problem it is not safe to allow V4L2, Exynos, and other frame vector users to create long standing / irrevocable memory registrations against filesytem-dax vmas. Cc: Inki Dae Cc: Seung-Woo Kim Cc: Joonyoung Shim Cc: Kyungmin Park Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Cc: Jan Kara Cc: Mel Gorman Cc: Vlastimil Babka Cc: Andrew Morton Cc: Fixes: 3565fce3a659 ("mm, x86: get_user_pages() for dax mappings") Signed-off-by: Dan Williams Reviewed-by: Jan Kara --- mm/frame_vector.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/frame_vector.c b/mm/frame_vector.c index 72ebec18629c..d2fdbeaadc8b 100644 --- a/mm/frame_vector.c +++ b/mm/frame_vector.c @@ -52,6 +52,10 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, ret = -EFAULT; goto out; } + + if (vma_is_fsdax(vma)) + return -EOPNOTSUPP; + if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { vec->got_ref = true; vec->is_pfns = false;