linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: cel@kernel.org, Hugh Dickins <hughd@google.com>,
	 Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	 yukuai3@huawei.com, yangerkun@huaweicloud.com,
	Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v6 4/5] libfs: Replace simple_offset end-of-directory detection
Date: Sat, 4 Jan 2025 12:29:38 +0100	[thread overview]
Message-ID: <20250104-goldbarren-gehalt-bb5039a20c69@brauner> (raw)
In-Reply-To: <pguxas3azhbjaf5peijhzzaul45h26lmh44or2vsulpxbnvv7m@apmmkc3mewq5>

On Mon, Dec 23, 2024 at 11:30:47AM -0500, Liam R. Howlett wrote:
> * cel@kernel.org <cel@kernel.org> [241220 10:33]:
> > From: Chuck Lever <chuck.lever@oracle.com>
> > 
> > According to getdents(3), the d_off field in each returned directory
> > entry points to the next entry in the directory. The d_off field in
> > the last returned entry in the readdir buffer must contain a valid
> > offset value, but if it points to an actual directory entry, then
> > readdir/getdents can loop.
> > 
> > This patch introduces a specific fixed offset value that is placed
> > in the d_off field of the last entry in a directory. Some user space
> > applications assume that the EOD offset value is larger than the
> > offsets of real directory entries, so the largest possible offset
> > value is reserved for this purpose. This new value is never
> > allocated by simple_offset_add().
> > 
> > When ->iterate_dir() returns, getdents{64} inserts the ctx->pos
> > value into the d_off field of the last valid entry in the readdir
> > buffer. When it hits EOD, offset_readdir() sets ctx->pos to the EOD
> > offset value so the last entry is updated to point to the EOD marker.
> > 
> > When trying to read the entry at the EOD offset, offset_readdir()
> > terminates immediately.
> > 
> > It is worth noting that using a Maple tree for directory offset
> > value allocation does not guarantee a 63-bit range of values --
> > on platforms where "long" is a 32-bit type, the directory offset
> > value range is still 0..(2^31 - 1).
> 
> I have a standing request to have 32-bit archs return 64-bit values.  Is

Yes, an allocation mechanism for 64-bit values on 32-bit would be very
nice to have.


  parent reply	other threads:[~2025-01-04 11:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-20 15:33 [PATCH v6 0/5] Improve simple directory offset wrap behavior cel
2024-12-20 15:33 ` [PATCH v6 1/5] libfs: Return ENOSPC when the directory offset range is exhausted cel
2024-12-23 16:28   ` Liam R. Howlett
2024-12-23 17:54     ` Chuck Lever
2024-12-20 15:33 ` [PATCH v6 2/5] Revert "libfs: Add simple_offset_empty()" cel
2024-12-23 14:17   ` yangerkun
2024-12-20 15:33 ` [PATCH v6 3/5] Revert "libfs: fix infinite directory reads for offset dir" cel
2024-12-23 14:17   ` yangerkun
2024-12-20 15:33 ` [PATCH v6 4/5] libfs: Replace simple_offset end-of-directory detection cel
2024-12-23 14:17   ` yangerkun
2024-12-23 16:30   ` Liam R. Howlett
2024-12-23 17:57     ` Chuck Lever
2025-01-04 11:29     ` Christian Brauner [this message]
2024-12-20 15:33 ` [PATCH v6 5/5] libfs: Use d_children list to iterate simple_offset directories cel
2024-12-23 14:21   ` yangerkun
2024-12-23 14:44     ` Chuck Lever
2024-12-24  4:40       ` yangerkun
2024-12-24 13:52         ` Chuck Lever
2024-12-24 13:57           ` yangerkun
2024-12-24 14:00             ` yangerkun
2024-12-24 16:10               ` Chuck Lever
2024-12-22 10:44 ` [PATCH v6 0/5] Improve simple directory offset wrap behavior Christian Brauner

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=20250104-goldbarren-gehalt-bb5039a20c69@brauner \
    --to=brauner@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yangerkun@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /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