From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:48576 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752848AbdFQMIP (ORCPT ); Sat, 17 Jun 2017 08:08:15 -0400 Date: Sat, 17 Jun 2017 14:08:14 +0200 From: Christoph Hellwig To: Linus Torvalds Cc: Tejun Heo , Greg Kroah-Hartman , linux-fsdevel@vger.kernel.org Subject: odd sysfs find behavior, was: Re: [PATCH v6 00/10] Implement NVMe Namespace Descriptor Identification Message-ID: <20170617120814.GA13236@lst.de> References: <20170607094536.32419-1-jthumshirn@suse.de> <20170615163141.GA27307@lst.de> <20170616094056.GA12465@lst.de> <905ed2e6-1c1c-f3a3-5391-66e42fb61861@suse.de> <20170616095837.GA14217@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Jun 16, 2017 at 10:28:28PM +0900, Linus Torvalds wrote: > Hmm. The *traditional* reason for this particular 'find' oddity is > that find has an optimization which will look at the nlink count of a > directory to decide how many subdirectories it can have. It looks like sysfs maintains i_nlink properly as far as I can tell. But I noticed another things that's even more weird: root@testvm:~/nvmetcli# find /sys -name uuid root@testvm:~/nvmetcli# find /sys -name uuid /sys/devices/virtual/nvme-fabrics/ctl/nvme2/nvme2n1/uuid so just repeating the find a second time makes it work! Looks like there is some sort of lazy population scheme in sysfs..