From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 1 01:12:01 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 8D30D106564A for ; Mon, 1 Mar 2010 01:12:01 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-exrelay3.uni-muenster.de (ZIVM-EXRELAY3.UNI-MUENSTER.DE [128.176.192.20]) by mx1.freebsd.org (Postfix) with ESMTP id 193968FC13 for ; Mon, 1 Mar 2010 01:12:00 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.49,557,1262559600"; d="scan'208";a="27201438" Received: from zivmaildisp1.uni-muenster.de (HELO ZIVMAILUSER03.UNI-MUENSTER.DE) ([128.176.188.85]) by zivm-relay3.uni-muenster.de with ESMTP; 01 Mar 2010 02:11:59 +0100 Received: by ZIVMAILUSER03.UNI-MUENSTER.DE (Postfix, from userid 149459) id 03B7B1B0750; Mon, 1 Mar 2010 02:11:58 +0100 (CET) Date: Mon, 01 Mar 2010 02:11:58 +0100 (CET) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: 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 01:12:01 -0000 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. 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.