From: OGAWA Hirofumi Subject: Re: [Bugme-new] [Bug 15909] New: open("a/", O_NOFOLLOW) fails with ELOOP if "a" is a symbolic link to a directory. Date: Mon, 10 May 2010 00:29:53 +0900 Message-ID: <87y6ft3xfy.fsf@devron.myhome.or.jp> References: <20100506143002.0381501b.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , Christoph Hellwig , bugzilla-daemon@bugzilla.kernel.org, bugme-daemon@bugzilla.kernel.org, tolzmann@molgen.mpg.de, linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from mail.parknet.co.jp ([210.171.160.6]:57505 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577Ab0EIQCi (ORCPT ); Sun, 9 May 2010 12:02:38 -0400 In-Reply-To: <20100506143002.0381501b.akpm@linux-foundation.org> (Andrew Morton's message of "Thu, 6 May 2010 14:30:02 -0700") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andrew Morton writes: >> mkdir c >> ln -s c a >> >> f=open("a/",O_RDONLY+O_NOFOLLOW) >> >> fails with ELOOP. However, this open should behave like open("a/.") not like >> open("a") according to path_resolution(7). In kernel version 2.6.32 the open >> worked as documented. >> >> On a higher level this bug makes >> >> find a/ >> >> to fail. >> > > It sounds like this 2.6.32->2.6.34-rc6 regression could have pretty > serious ramifications for some users. Does anyone know whcih commit > might have caused it? This probably is the part of do_last cleanup series. (I was looking this series, but unfortunately I also didn't notice about this bug..) And with quick-look, it seems to be in do_last(): /* trailing slashes? */ if (nd->last.name[nd->last.len]) { if (open_flag & O_CREAT) goto exit; nd->flags |= LOOKUP_DIRECTORY; } Before (i.e. do_path_lookup()), it was doing with LOOKUP_FOLLOW for "trailing slash". Current one, it isn't. If Al or someone don't fix, I'll see more later (it may be next weekend or so, sorry). Thanks. -- OGAWA Hirofumi