From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Hengyu Liang <hengyul@cs.unc.edu>
Cc: glaubitz@physik.fu-berlin.de, frank.li@vivo.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] hfs: avoid reusing occupied CNIDs after deletion
Date: Mon, 23 Nov 2026 14:08:32 -0800 [thread overview]
Message-ID: <fa6344cbb419012d7deed74d30ae6062eda92fc1.camel@dubeyko.com> (raw)
In-Reply-To: <20261121101918.3395879-1-hengyul@cs.unc.edu>
On Sat, 2026-11-21 at 05:19 -0500, Hengyu Liang wrote:
> Hi Slava,
>
> Sorry for the late reply. I have an important deadline in early
> December, so I may be slow to reply until then.
No problem. Take your time.
>
> On Mon, 2026-11-16 at 15:21 -0800, Viacheslav Dubeyko wrote:
> > You explained a simple case. :) My worry was about the case when we
> > could delete some number of items between [16, 20]. For example, we
> > delete 17, 18, and 19 at first. And now we delete item with #20.
> > So,
> > leaf A should have 16 as a maximum CNID. And we can use 17 as a
> > next_id. Correct?
>
> Correct. I ran this case with the patch on a fresh volume. Creating
> a, c, e, b, d gives CNIDs 16 to 20 in three leaves:
>
> leaf 1: root folder (2), thread of 2, a (16), b (19) max 19
> leaf 2: c (17), d (20), e (18) max 20
> leaf 4: threads of 16 to 20 no file or
> folder
>
> rm c (17), rm e (18): not the newest CNID, next_id stays 21;
> leaf maximums 19 and 20 stay
> rm b (19): leaf 1's maximum has to be recomputed, the
> root keeps 20 (from leaf 2)
> rm d (20): leaf 2 is now empty and goes away, the root's
> maximum has to be recomputed: leaf 1 -> 16,
> root -> 16, next_id = 17
>
> The next new file gets CNID 17. I checked it three ways: with the
> values cached before the deletes, with nothing cached yet, and with a
> remount between the creates and the deletes. A debug build that
> compares every cached value with the records after each insert and
> remove found no mismatch.
>
> A larger case: 2000 files created in shuffled name order, so the
> CNIDs are spread over the leaves. Deleting CNIDs 1916..2014 first and
> then 2015 gives next_id 1916, and the next file gets 1916. Without
> the
> patch the same steps end with "File exists". fsck.hfs reports all
> images as OK.
>
>
OK. Sounds good.
Thanks,
Slava.
next prev parent reply other threads:[~2026-11-23 22:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 11:01 Hengyu Liang
2026-11-12 22:34 ` Viacheslav Dubeyko
2026-11-13 19:14 ` Viacheslav Dubeyko
2026-11-13 19:41 ` Hengyu Liang
2026-11-16 23:21 ` Viacheslav Dubeyko
2026-11-21 10:19 ` Hengyu Liang
2026-11-23 22:08 ` Viacheslav Dubeyko [this message]
2026-11-17 1:02 ` Viacheslav Dubeyko
2026-11-18 0:20 ` Viacheslav Dubeyko
2026-11-21 10:19 ` Hengyu Liang
2026-11-23 22:18 ` Viacheslav Dubeyko
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=fa6344cbb419012d7deed74d30ae6062eda92fc1.camel@dubeyko.com \
--to=slava@dubeyko.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=hengyul@cs.unc.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.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
all inboxes | Powered by JetHome®