Re: Fwd: Re: A new look at old NFS readdir() problems?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Larry Rosenman <ler(at)lerctr(dot)org>, Pgsql hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fwd: Re: A new look at old NFS readdir() problems?
Date: 2025-01-03 18:12:43
Message-ID: 469548.1735927963@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
> On 03.01.25 02:58, Tom Lane wrote:
>> I poked at this a little further. I made the attached stand-alone
>> test case (you don't need any more than "cc -o rmtree rmtree.c"
>> to build it, then point the script at some NFS-mounted directory).
>> This fails with my NAS at least as far back as FreeBSD 11.0.
>> I also tried it on NetBSD 9.2 which seems fine.

> If you use some GUI file manager, point at a directory, and select
> "remove this directory with everything in it", what does it do
> internally? Surely it runs a readdir() loop and unlinks the files as it
> gets to them? Or does it indeed slurp the whole directory tree into
> memory before starting the deletion?

One thing I noticed while testing yesterday is that "rm -rf foo"
worked even in cases where "rmtree foo" didn't. I did not look
into FreeBSD's rm code, but I'll bet it has the sort of retry
logic that was recommended to us upthread. I agree with your
point though that it's hard to believe that everyone does that
in every case where it would matter.

As for pre-existing bug reports, I found

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=57696

but there's basically no new information there, other than
the not-so-surprising fact that renaming directory entries
triggers the failure as efficiently as unlinking does.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-01-03 18:30:14 improve DEBUG1 logging of parallel workers for CREATE INDEX?
Previous Message Peter Eisentraut 2025-01-03 17:31:37 Re: Fwd: Re: A new look at old NFS readdir() problems?