From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH 04/20] sysfs: Handle the general case of removing of directories with subdirectories Date: Sat, 23 May 2009 13:09:54 -0700 Message-ID: References: <1242865694-2100-4-git-send-email-ebiederm@xmission.com> <4A14F356.3030501@kernel.org> <4A15046A.10106@kernel.org> <4A1512E2.2040505@kernel.org> <4A151ECE.50800@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Tejun Heo , Andrew Morton , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Cornelia Huck , linux-fsdevel@vger.kernel.org, "Eric W. Biederman" To: Kay Sievers Return-path: Received: from out02.mta.xmission.com ([166.70.13.232]:39365 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbZEWUKD convert rfc822-to-8bit (ORCPT ); Sat, 23 May 2009 16:10:03 -0400 In-Reply-To: (Kay Sievers's message of "Sat\, 23 May 2009 13\:35\:48 +0200") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Kay Sievers writes: > On Sat, May 23, 2009 at 08:33, Eric W. Biederman wrote: > >> My plan going forward is to fix the ordering problems with deleting >> /sys/dev/char and /sys/dev/block. =C2=A0Add a WARN_ON if we delete a >> non-empty directory. =C2=A0Ensure we don't add something to an alrea= dy >> deleted directory. > > What's the problem in /sys/dev/? There are just a bunch of symlinks, > one for every device with a dev_t, and all in flat directories, and n= o > directory to remove. device_shutdown called during reboot removes /sys/dev/block and /sys/de= v/char. The current sysfs_remove_dir (because it empties directories) removes all of those symlinks. The problem is that it is the device objects for each individual device that owns those symlinks, and normally removes those symlinks. Which means that in theory we could have double deletion going on. In practice today it doesn't matter because this is at reboot. And as far as that goes it is wrong to remove anything from sysfs durin= g device_shutdown so the fix is just to not call kobject_put there. Eric -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html