From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: /proc/pid/fd/ shows strange mode when executed via sudo. Date: Fri, 18 May 2012 14:26:28 -0700 Message-ID: References: <201205181139.IAI65153.OQOtFVJFHLSMOF@I-love.SAKURA.ne.jp> <201205181827.BAF57803.OLQMFVtFFOHSJO@I-love.SAKURA.ne.jp> <20120518180812.GR22082@ZenIV.linux.org.uk> <20120518184526.GS22082@ZenIV.linux.org.uk> <20120518191023.GU22082@ZenIV.linux.org.uk> <20120518212302.GW22082@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Tetsuo Handa , ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org To: Al Viro Return-path: Received: from mail-wi0-f172.google.com ([209.85.212.172]:48624 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967724Ab2ERV0u convert rfc822-to-8bit (ORCPT ); Fri, 18 May 2012 17:26:50 -0400 Received: by wibhj8 with SMTP id hj8so540589wib.1 for ; Fri, 18 May 2012 14:26:48 -0700 (PDT) In-Reply-To: <20120518212302.GW22082@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, May 18, 2012 at 2:23 PM, Al Viro wrot= e: > > I would agree if we only called that on lookup. =A0We also do that on > readdir(), for every descriptor in range 0..files->max_fds-1. =A0So > if you have sufficiently sparse set of descriptors, it will be > called a _lot_. =A0Moreover, that's the usual path for calling it, > exactly because we do getdents before trying to open/lstat/anything > else. Ahh, good catch. However, wouldn't it be better to move the check you added to the readdir() path, then, so that we don't do it unnecessarily for lookups.. I'll check how that looks. Linus -- 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