From: bugzilla-daemon@bugzilla.kernel.org
To: linux-ext4@kernel.org
Subject: [Bug 196405] mkdir mishandles st_nlink in ext4 directory with 64997 subdirectories
Date: Wed, 19 Jul 2017 19:44:49 +0000 [thread overview]
Message-ID: <bug-196405-13602-nIVYH7CkIE@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-196405-13602@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=196405
--- Comment #12 from Paul Eggert (eggert@cs.ucla.edu) ---
(In reply to Theodore Tso from comment #1)
> 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.
POSIX says that mkdir should fail with EMLINK if the link count in the parent
directory would exceed LINK_MAX. If the POSIX-compliant mode is setting
errno==ENOSPC then that sounds like a bug; it should fail with errno==EMLINK.
Although the documentation for tune2fs says that dir_nlink can be cleared in an
existing ext4 filesystem, this did not work for me on Fedora 26 x86-64. I
unmounted the filesystem, ran "tune2fs -O ^dir_nlink /dev/sda2", remounted the
filesystem, and verified that dir_nlink was turned off by running "dumpe2fs -h
/dev/sda2". The fts-test.c program attached to this bug report still failed in
the same way. Either this is a filesystem bug that should be fixed, or the
documentation should be changed so that it does not incorrectly say that
tune2fs can usefully change the dir_nlink option.
I then created a new ext4 file system with dir_nlink disabled from birth. Here,
the test program failed in mkdir ("d/32757", 0777) with ENOSPC. Yet there was
plenty of space in the file system, and the link count was only 32758, which is
way lower than LINK_MAX (which is 65000). Presumably the ext4 code arbitrarily
limits the link count to 32758 (i.e., to 2**15 - 10) when dir_nlink is clear.
This sounds like a bug; the limit should be 65000.
One more thing. In the typical case where dir_nlink is set, there is an
off-by-one error, as LINK_MAX is 65000 and in fts-test.c the link count should
be 65000 so this should work. That is, the link count should wrap around to 1
when it would otherwise reach 65001, not when it would otherwise reach 65000.
--
You are receiving this mail because:
You are watching the assignee of the bug.
next prev parent reply other threads:[~2017-07-19 19:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 21:23 [Bug 196405] New: mkdir mishandles st_nlink in ext4 directory with 64997 subdirectories bugzilla-daemon
2017-07-18 19:41 ` [Bug 196405] " bugzilla-daemon
2017-07-18 21:07 ` bugzilla-daemon
2017-07-18 21:37 ` bugzilla-daemon
2017-07-18 21:54 ` bugzilla-daemon
2017-07-18 21:57 ` bugzilla-daemon
2017-07-18 22:19 ` bugzilla-daemon
2017-07-18 23:12 ` bugzilla-daemon
2017-07-18 23:15 ` bugzilla-daemon
2017-07-19 5:35 ` bugzilla-daemon
2017-07-19 8:02 ` bugzilla-daemon
2017-07-19 14:49 ` bugzilla-daemon
2017-07-19 19:44 ` bugzilla-daemon [this message]
2017-07-19 19:59 ` bugzilla-daemon
2017-07-19 22:22 ` bugzilla-daemon
2017-07-20 0:59 ` bugzilla-daemon
2017-07-21 7:48 ` bugzilla-daemon
2017-07-21 8:22 ` bugzilla-daemon
2017-07-21 15:25 ` bugzilla-daemon
2017-07-21 18:34 ` bugzilla-daemon
2017-07-21 21:14 ` bugzilla-daemon
2017-07-21 21:47 ` bugzilla-daemon
2017-07-22 14:41 ` bugzilla-daemon
2017-07-23 16:23 ` bugzilla-daemon
2017-07-23 22:55 ` bugzilla-daemon
2017-07-24 18:48 ` bugzilla-daemon
2017-07-25 8:56 ` bugzilla-daemon
2017-07-25 9:05 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-196405-13602-nIVYH7CkIE@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-ext4@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).