From owner-freebsd-questions@FreeBSD.ORG Sat Jul 27 15:30:23 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3F6818BC for ; Sat, 27 Jul 2013 15:30:23 +0000 (UTC) (envelope-from david.i.noel@gmail.com) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C977029E9 for ; Sat, 27 Jul 2013 15:30:22 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id c10so1837862wiw.4 for ; Sat, 27 Jul 2013 08:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Is2zarEOSJy48vfYly6LUO9XWlHIF/GQj856iEK36c8=; b=Wu3dfzoomiqczjwLnsymXlggVB6QqyLyT0T0puan9n6lyiBoYnr1lkZTgY7ZluZrFy iYnWNkdfk4iuvyAwLTQha3YXMwjjZqEFmWPiFalLeeUMARZXHXlvdieuijG+yBrObC4X poSYott/KHhpLvTTSjyKLjDxsrCcLmT6NjwNJtuPHM3h7ZIAGoUkaF+2vJC/DDoQ5laJ wMlw8stssl0O266ZPeJP7n30meAPL6vETmkYA4+7aIZtS52MjzA8v0SM32mjiCJvHOvR GmdJH4Gb1a1aSZhay36YY7ockN/wkGXvD5UQ7WRYwTsg93pjmK94GEAmAn6jZ9Kzjs3M 8OOw== MIME-Version: 1.0 X-Received: by 10.180.183.180 with SMTP id en20mr2160606wic.58.1374939021219; Sat, 27 Jul 2013 08:30:21 -0700 (PDT) Received: by 10.216.180.138 with HTTP; Sat, 27 Jul 2013 08:30:21 -0700 (PDT) In-Reply-To: <51F3E0F1.3010401@fjl.co.uk> References: <51F3E0F1.3010401@fjl.co.uk> Date: Sat, 27 Jul 2013 10:30:21 -0500 Message-ID: Subject: Re: Delete a directory, crash the system From: David Noel To: Frank Leonhardt Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: David.I.Noel@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 15:30:23 -0000 > I'm taking a guess here - the effective link count when it came to > removing the parent directory was only two and it should have been three > or more. This gets sanity checked this before proceeding, and panics if > it is not. Why an effective link count of three? We're talking about the > parent of the directory you're trying to zap, right? There's the link to > the directory from its parent, and the '.' link and the ".." link from > the directory you're trying to remove. There may be more if it contains > other directories, but there can't be less. > > Anyway - if you only had a link count of just two effective links at the > start of the delete process it suggests that the link count was messed > up - either a link never existed or its count was wrong. Should the > kernel panic? Well it's a situation that can never happen - it could > simply remove the directory and pretend everything was okay but guess > it was decided it was likely to be a symptom of impending disaster. > Other anomalies return an error. > > In over ten years with FreeBSD systems I can't say I've ever seen this > "cannot happen" situation arise. I'd guess you had an interrupted (by > power failure) inode operation at some time which caused the corruption. > removing a directory is a PITA as it can lead to a race - a context swap > could create a file it it mid-way through the process. > > Regards, Frank. Interesting. Thanks for the analysis. I'm not a systems guy (Java, mostly), so I don't really have the context to make much sense of kgdb output. What you're saying though makes sense and sounds about right -- it's a laptop and I've inadvertently run the battery down to nothing a few times in the past. All the same, it was a very strange experience. I would not have expected a kernel panic from a simple rm -rf!