From patchwork Thu Aug 25 16:42:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 9299589 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 0B0E160459 for ; Thu, 25 Aug 2016 16:43:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0C952926C for ; Thu, 25 Aug 2016 16:43:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4BFF293A1; Thu, 25 Aug 2016 16:43:32 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 831B82926C for ; Thu, 25 Aug 2016 16:43:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id ABB001A1E4D; Thu, 25 Aug 2016 09:43:31 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6A7E91A1E4D for ; Thu, 25 Aug 2016 09:43:30 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 25 Aug 2016 09:43:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,576,1464678000"; d="scan'208"; a="1031247644" Received: from rzwisler-desk.amr.corp.intel.com (HELO theros.lm.intel.com) ([10.232.112.65]) by fmsmga001.fm.intel.com with ESMTP; 25 Aug 2016 09:43:28 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org Subject: [PATCH v2 RESEND] mm: silently skip readahead for DAX inodes Date: Thu, 25 Aug 2016 10:42:32 -0600 Message-Id: <20160825164232.8989-1-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160824221429.21158-1-ross.zwisler@linux.intel.com> References: <20160824221429.21158-1-ross.zwisler@linux.intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Morton , linux-nvdimm@lists.01.org, Dave Hansen , Dave Chinner , stable@vger.kernel.org, linux-mm@kvack.org, Jan Kara MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP For DAX inodes we need to be careful to never have page cache pages in the mapping->page_tree. This radix tree should be composed only of DAX exceptional entries and zero pages. ltp's readahead02 test was triggering a warning because we were trying to insert a DAX exceptional entry but found that a page cache page had already been inserted into the tree. This page was being inserted into the radix tree in response to a readahead(2) call. Readahead doesn't make sense for DAX inodes, but we don't want it to report a failure either. Instead, we just return success and don't do any work. Signed-off-by: Ross Zwisler Reported-by: Jeff Moyer Cc: [4.5+] --- Changes from v1: - Added a comment so readers don't have to go putzing around in the git tree to understand why we're doing what we're doing. :) (akpm) - Resending, adding stable@vger.kernel.org. Thank you, akpm, for the catch. --- mm/readahead.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index 65ec288..c8a955b 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -544,6 +545,14 @@ do_readahead(struct address_space *mapping, struct file *filp, if (!mapping || !mapping->a_ops) return -EINVAL; + /* + * Readahead doesn't make sense for DAX inodes, but we don't want it + * to report a failure either. Instead, we just return success and + * don't do any work. + */ + if (dax_mapping(mapping)) + return 0; + return force_page_cache_readahead(mapping, filp, index, nr); }