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

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <tmunro(at)freebsd(dot)org>
Subject: Re: Fwd: Re: A new look at old NFS readdir() problems?
Date: 2025-01-02 21:16:06
Message-ID: 003f46cfd6fd68a6ae31e0e0a83cffea@lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/02/2025 2:50 pm, Bruce Momjian wrote:
> On Thu, Jan 2, 2025 at 03:48:53PM -0500, Tom Lane wrote:
>> Larry Rosenman <ler(at)lerctr(dot)org> writes:
>> > @Tom Lane: This is what Rick Macklem (NFS dev on FreeBSD) has to say on
>> > my issue.
>>
>> Thanks for reaching out to him. So if I'm reading this correctly,
>> there's little point in filing a FreeBSD bug because it'll be
>> dismissed as unfixable.
>>
>> This leaves us in rather a nasty position. Sure, we could rewrite
>> rmtree() as Thomas suggested upthread, but I'm still of the opinion
>> that that's smearing lipstick on a pig. rmtree() is the least of
>> our worries: it doesn't need to expect that anybody else will be
>> modifying the target directory, plus it can easily restart its scan
>> without complicated bookkeeping. I doubt we can make such an
>> assumption for all our uses of readdir(), or that it's okay to
>> miss or double-process files in every one of them.
>>
>> I'm still of the opinion that the best thing to do is disclaim
>> safety of storing a database on NFS.
>
> It would be nice to have some details on the docs about why NFS can
> cause problems so we have something to point to when people ask.

What about doing what Rick suggests?
do {
dir = opendir("X");
dp = readdir(dir);
if (dp != NULL)
unlink(dp->d_name);
close(dir);
} while (dp != NULL);
?
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-642-9640 E-Mail: ler(at)lerctr(dot)org
US Mail: 13425 Ranch Road 620 N, Apt 718, Austin, TX 78717-1010

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-01-02 21:19:44 Re: magical eref alias names
Previous Message Jim Nasby 2025-01-02 21:14:13 Re: Vacuum statistics