Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751284Ab3IJSnb (ORCPT ); Tue, 10 Sep 2013 14:43:31 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:58189 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954Ab3IJSna (ORCPT ); Tue, 10 Sep 2013 14:43:30 -0400 Date: Tue, 10 Sep 2013 19:43:24 +0100 From: Al Viro To: Linus Torvalds Cc: Josh Boyer , Waiman Long , "Linux-Kernel@Vger. Kernel. Org" , moneta.mace@gmail.com Subject: Re: kernel BUG at fs/dcache.c:648! with v3.11-7890-ge5c832d Message-ID: <20130910184324.GY13318@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1536 Lines: 32 On Tue, Sep 10, 2013 at 11:25:44AM -0700, Linus Torvalds wrote: > nd->flags &= ~LOOKUP_RCU; > if (!(nd->flags & LOOKUP_ROOT)) > nd->root.mnt = NULL; > unlock_rcu_walk(); > > and my unlazy_walk() essentially terminated the walk _without_ > clearing that nd->root.mnt thing (it did clear the LOOKUP_RCU bit and > unlock_rcy_walk(). So then later, we'd end up doing an extra > path_put(). Explaining a zero d_lockref.count. > > The whole damn root.mnt behavior with !LOOKUP_ROOT is a mystery and > needs more comments. But the attached trivial patch should do the > missing portion of terminate_walk(). > > Al, can you walk us through the rules for what "root.mnt == NULL" > really means? It's basically used as a flag for whether we've gotten > the root pointer or not. But it's pretty damn esoteric. LOOKUP_ROOT: the caller has set nd->root and we shouldn't touch that at all. !LOOKUP_ROOT: we set nd->root the first time we need / (in the very beginning if it's an absolute pathname, on the first absolute symlink otherwise). In non-RCU mode we hold a reference to it; in RCU mode we do not. As the result, leaving RCU mode should either grab a reference to the damn thing (if we intend to go on) or zero it out. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/