From patchwork Fri Oct 9 17:44:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 7362871 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6985CBEEA4 for ; Fri, 9 Oct 2015 17:45:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7ED6E207A8 for ; Fri, 9 Oct 2015 17:45:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81465207A4 for ; Fri, 9 Oct 2015 17:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933308AbbJIRot (ORCPT ); Fri, 9 Oct 2015 13:44:49 -0400 Received: from mail-yk0-f174.google.com ([209.85.160.174]:36527 "EHLO mail-yk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932535AbbJIRor (ORCPT ); Fri, 9 Oct 2015 13:44:47 -0400 Received: by ykba192 with SMTP id a192so81216848ykb.3 for ; Fri, 09 Oct 2015 10:44:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bVuKlAOFWIPnNcFvhWCdknV5MI8vmo78Bbi1tvHIbBQ=; b=gunsa5+STNkrLXDu+BXywgix43lUrZFSzVIzJQzkiZtWmR7aW9mEEBkYozQ2Sb0dXd 3UUG33RK8wU0FmCFL81oqJ5YAqO31/dTtGXU8o1eNLB6mBGeAWjUtu6q3JRLzTFe5wRr Zx1Drwcv285L/+Y1fUs7BRVDAP7rAzmf0AcdB1Qd9LXlsIZNBJmBgtQXMBerOXK6lR7f M/EDIxbTB2Mhe+TiVF5gqUM+617hFlr3h6E1By/2WTAxNiYH21OBAdy0jxWz/vWQey1n pLV5if1VOYbbzq30LOYZ4OZ0FrMTfaj7eJ0AczLTBDdM4I5OwC3yAsJzdEVOKHp7yJ4z YTgQ== X-Gm-Message-State: ALoCoQnRN8ZbTIv6igMq9JGEmxAsFaaB9CS6Wv1agwLWMms6aXuH0kV+LVqOJP439kbdZOS72kE6 X-Received: by 10.129.79.211 with SMTP id d202mr10057263ywb.240.1444412687249; Fri, 09 Oct 2015 10:44:47 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (97-83-40-64.dhcp.trcy.mi.charter.com. [97.83.40.64]) by smtp.gmail.com with ESMTPSA id i187sm1638631ywg.41.2015.10.09.10.44.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2015 10:44:46 -0700 (PDT) From: Trond Myklebust To: Linus Torvalds Cc: Alexander Viro , Leandro Awa , Linux NFS Mailing List , Linux FS-devel Mailing List , linux-kernel@vger.kernel.org Subject: [PATCH] namei: results of d_is_negative() should be checked after dentry revalidation Date: Fri, 9 Oct 2015 13:44:34 -0400 Message-Id: <1444412674-3077-1-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <9459055931ab4f269b96bad953738778@HQMAIL102.nvidia.com> References: <9459055931ab4f269b96bad953738778@HQMAIL102.nvidia.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Leandro Awa writes: After switching to version 4.1.6, our parallelized and distributed workflows now fail consistently with errors of the form: T34: ./regex.c:39:22: error: config.h: No such file or directory From our 'git bisect' testing, the following commit appears to be the possible cause of the behavior we've been seeing: commit 766c4cbfacd8 The issue is that revalidation may cause the dentry to be dropped in NFS if, say, the client notes that the directory timestamps have changed. Reported-by: Leandro Awa Link: https://bugzilla.kernel.org/show_bug.cgi?id=104911 Fixes: 766c4cbfacd8 ("namei: d_is_negative() should be checked...") Tested-by: Leandro Awa Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Trond Myklebust --- fs/namei.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 726d211db484..33e9495a3129 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1558,8 +1558,6 @@ static int lookup_fast(struct nameidata *nd, negative = d_is_negative(dentry); if (read_seqcount_retry(&dentry->d_seq, seq)) return -ECHILD; - if (negative) - return -ENOENT; /* * This sequence count validates that the parent had no @@ -1580,6 +1578,12 @@ static int lookup_fast(struct nameidata *nd, goto unlazy; } } + /* + * Note: do negative dentry check after revalidation in + * case that drops it. + */ + if (negative) + return -ENOENT; path->mnt = mnt; path->dentry = dentry; if (likely(__follow_mount_rcu(nd, path, inode, seqp)))