[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bug-196405-13602-VReWEVAIbl@https.bugzilla.kernel.org/>
Date: Tue, 18 Jul 2017 19:41:01 +0000
From: bugzilla-daemon@...zilla.kernel.org
To: linux-ext4@...nel.org
Subject: [Bug 196405] mkdir mishandles st_nlink in ext4 directory with 64997
subdirectories
https://bugzilla.kernel.org/show_bug.cgi?id=196405
--- Comment #1 from Theodore Tso (tytso@....edu) ---
On Mon, Jul 17, 2017 at 09:23:44PM +0000, bugzilla-daemon@...zilla.kernel.org
wrote:
> See the following shell transcript, run in an ext4 directory, for an
> illustration of the bug. The first four commands set things up. The 5th
> command
> 'mkdir d/64998' calls 'mkdir("d/64998, 0777)' and succeeds. The 6th command
> shows that d's resulting st_nlink value is 1, which is incorrect; it should
> be
> 65000. I discovered this bug in Fedora 26, which runs Linux 4.11.10; from
> inspecting the source it appears the bug is still there in 4.13-rc1.
This is actually working as intended. In order to support a large
number of directories, when we have a 16-bit link count field, we use
a link count of 1 to mean, "lots".
If you don't want this behavior because strict POSIX compliance is
preferable to failing with ENOSPC when you hit that overflow
condition, you can create the file system with the dir_nlink feature
turned off.
I will note that various userspace utilities that try to optimize
directory walking by depending on the directory's link count to
understand when they have found all of the subdirectories know that
directory link count of 1 means "lots". This is why a link count of 1
was chosen.
- Ted
--
You are receiving this mail because:
You are watching the assignee of the bug.
Powered by blists - more mailing lists