From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 1 02:26:11 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A98A41065672 for ; Mon, 1 Mar 2010 02:26:11 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-pz0-f197.google.com (mail-pz0-f197.google.com [209.85.222.197]) by mx1.freebsd.org (Postfix) with ESMTP id 7FBB08FC31 for ; Mon, 1 Mar 2010 02:26:11 +0000 (UTC) Received: by pzk36 with SMTP id 36so448025pzk.8 for ; Sun, 28 Feb 2010 18:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=t91SaagpVEFLLd8WBGf/mEET7Zr+IoKXKwps5HLaEbA=; b=tW5BFhPwQIhqKyc3MvvymUJT6Ph76qGPHvspPDzQKaqpjV9FYsZbhyci0q0jlYYhMO B4rWcrmUcyGCYSDj34mD9qKW2TsAyZZO9r4WFrGAE/rQrK622eaMHn9RGcDn9DFq2pik P30DabATdQyW6X6k6dKs1j0Svo3gI/QPdMmP8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=dN5PpcOxdv/YOq7++WjFp3qRCwdQ1hZJ4/MjybADY8in50Bs6O1l5hnwkMO4lUw0DA qWVu5ViEUY72MPeyY5V+GE72K/O+ixwcDr/c+KOhqHgrOENiwxMbBK5GbL7YLCRlj36S 2pUHIZyFwlU2hsApabWzQNTwiEAFat0nwKdds= MIME-Version: 1.0 Received: by 10.142.152.8 with SMTP id z8mr2192358wfd.230.1267410365877; Sun, 28 Feb 2010 18:26:05 -0800 (PST) In-Reply-To: References: Date: Sun, 28 Feb 2010 18:26:05 -0800 Message-ID: <7d6fde3d1002281826n60c2061fiedfc4e548cc9f068@mail.gmail.com> From: Garrett Cooper To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: namei() returns EISDIR for "/" (Re: svn commit: r203990 - head/lib/libc/sys) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2010 02:26:11 -0000 On Sun, Feb 28, 2010 at 5:11 PM, Alexander Best wrote: > i have a small test app to check {rm|mk}dir()'s errnos with certain args like > /, ., /proc and non-empty dirs. i'll submit it to this thread as soon as i > also add testcases for syscalls like rename(), unlink(), etc. > > most of the errno codes returned after applying your patch look correct. i > wonder however why rmdir("/proc") returns EACCESS as unprivileged user. > wouldn't it make more sense to also return EBUSY? why complain about > permission related matters when even root won't be able to perform the > operation. Hmm.. good question. POSIX doesn't fully expound on this case (http://www.opengroup.org/onlinepubs/009695399/functions/rmdir.html), and either seem possible... > also: since namei() takes care of handling the "/" and "." cases couldn't > those checks in kern_rmdirat() and kern_unlinkat() be removed? > > it might also be interesting to look at the changes netbsd, openbsd and > dragonflybsd have made to vfs_lookup.c. just had a quick look at revision > 1.121 from netbsd and they have split lookup() into loads of smaller functions > (see revision 1.117 and 1.118). seems they have been doing a lot of work here > (using heavy XXX-commenting however). > > openbsd hasn't made to many changes to vfs_lookup.c. > > matthew dillon seems to have done an incredible job on dragonfly in connection > with vfs_lookup.c. basically they completely got rid of namei() and are now > using nlookup() in commit ad57d0edbfceb0cebfb1dce61490df78fcc4a97. the commit > message is quite long and claims due to this change all syscalls which used to > call namei() have become a lot less complex after switching to nlookup(). > > right now vfs_lookup.c in dragonfly contains only some legacy code used for > compatibility. > > again: an incredible job! > > +1 for adapting those changes. ;) > > cheers. > alex > > btw.: there're a few NAMEI_DIAGNOSTIC ifdefs in vfs_lookup.c to increase > verbosity. Thanks, -Garrett