[PATCH 2 of 2] lock: include Linux pid namespace identifier in prefix
Jun Wu
quark at fb.com
Mon Feb 13 16:03:40 EST 2017
Excerpts from Augie Fackler's message of 2017-02-13 14:55:57 -0500:
> On Fri, Feb 10, 2017 at 04:50:55PM -0800, Jun Wu wrote:
> > I'd like to note that although this patch prevents repo corruption when
> > running hg inside different containers (which has different pid namespaces),
> > it does not prevent deadlock - if an hg process is SIGKILL-ed, every other
> > process will not able to take or remove the lock.
>
> Sigh. Thanks for the fix, queued (and a fist shaken at this weird/poor
> choice from linux containers.)
I think Linux pidns has no choice - pid 1 is special so 1 will collide for
sure. If pids are not unique globally, we will have the issue.
> > I think if we do know the repo is not on NFS, and the system supports
> > flock(), flock() is way more robust and solves all kinds of pain here.
> >
> > I hereby propose a new repo requirement "flock", once set, use flock instead
> > of the traditional lock file. It's off by default. Thoughts?
>
> I'm...not categorically opposed to it, though it feels pretty risky. I
> know git doesn't use flock() either - presumably there's a good reason
> I don't know about that neither tool relies on it?
I think that's because the troubled use-case is rare. It requires:
1. Different pid namespaces
2. Shared mount namespace / subtree
"2" is not satisfied for typical containers. But it happens at Facebook.
I think it could be an extension outside core.
More information about the Mercurial-devel
mailing list