Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waasJ-001ujt-2R for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 15:11:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1waasH-00Gqhu-28 for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 15:11:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <9erthalion6@gmail.com>) id 1waasH-00Gqhl-1G for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 15:11:17 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from <9erthalion6@gmail.com>) id 1waasG-000000019oo-0LZi for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 15:11:16 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-695bba79ae1so3113115a12.1 for ; Fri, 19 Jun 2026 08:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781881874; x=1782486674; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WDWQMEDNdEQ6c/NqSdSZlx54rnd2yCm+3Bo/ViQBkrE=; b=Eq20eHlEhqenNM7qd0+M1di+SMryRJgo2IBBSFcxRB9lQ7LBeUVJtAwDm2FGvxWysi yAzSXOPsPEqCaT93e7ruxHI20TVJ4oumvTb8819AUrf3JR0ZNuY8Q+Hp59SBnXz5tbzb 58RGZBthz/tpSKmcYznjxNcPcbFKfHWhrEre5xb3f5lZSxac8trlF0HQ0E2hzhrlogGQ gOZgWT20ElarjxP3SqrNvjWjj4k616FT1JNMuFU2u9uCKDEZKF2dJGexuJqgLDMFQINl oqws1fDUhwWomsZ86RgpZirLYfgg1+LrGZY9Wf/GkBkZxSe91Any5k6AoyE1zZ/cMrBg ZKTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781881874; x=1782486674; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WDWQMEDNdEQ6c/NqSdSZlx54rnd2yCm+3Bo/ViQBkrE=; b=dPJCRuM1Xo+VlqCLF++cww7Z+VFP/Aj/x3HaVTT6oRXJHOPovQhNMdFTQPtCQp5MVV Lk4w/oioXjd+QBUlFK+5K1gqykGbb0fivcIFzl7ZOg5MCAzbdcsKKopXOD+pYoFdGnlk pyXQqm/ctW0W9/6d3OlsTT9jjcX/5v+KcXVj4seD9xuquCEqot5w3JccGCIuOOGYoWnw wxC9R6y49ckyUg1wPVt4D19yH7oaX9+C5I9HVzl2Hhv5eESlbjSZcXLBIoYZuVzRx8L7 oF7B2cdkC0MYaLFR0xuZMtsFRPGGua8hlcFB2rg5CHeN0/eUDR1KbJknyXNB9lfK2Ix/ dr4A== X-Gm-Message-State: AOJu0YxTDAKogb5bvBx3MHxfCeKZ9yYItKJVzr9awyywnDz9z10w61xA /VcqyKY0cX9CL3fesdjOZu0Vpp/EbW0opj4xvxTz6+lRDAoOYM7UmBK7 X-Gm-Gg: AfdE7cm6CunwKptmsRjcMQuG95fdfL7hGBR+tSUnFZRUQGlINAxOgywNxpP8DPNXQVz ikLZtg2nCx8XszN9bTU+RWmOJ/8bVddGs0QwmRJ941V5XraAPyyo3KW61y7gKE0quLoT3ZDzHDT PBILGweiacLlg09RUTfffp6M92GlsjzrWSirY/7HVE1y09rlWRkif0GBNJfH3c3zHOJU3HhOYTn kyfxfRDK/yKvILVSTsQLDIb6PsNO6iRf+mkt9vxOVkuFznCh+KSYmI7H3lCFOzvqDlV+Yxevjhq IZwW5cxoG3s7TNFzPI1H1NuRdtJ+k+KAzIKBEoEcZcxtihuWG2PL4qiDGDth362ZclpAgLVKCaN smQLvlvTQ/BlRdTc1Swl5yBXOM0tymLJyx/0hG+cEd02wF+NUU1k2z2eznnFFgYsQe9L+Ux/bbj 7sf06kTVJRQsLqjeq+rXki7b8+sJcPrpFhUiZAv7kTWvOlr3Wvo2DS6oFwbUQUSSTdhiqwKqXEu /0gwsDSGTZlXWlqn5Md8iaguT+DiQ== X-Received: by 2002:a17:907:7ba7:b0:bee:280b:8bec with SMTP id a640c23a62f3a-c09a798e0dcmr205765866b.4.1781881873857; Fri, 19 Jun 2026 08:11:13 -0700 (PDT) Received: from ddolgov-thinkpadt14sgen1.rmtde.csb (dslb-092-077-218-103.092.077.pools.vodafone-ip.de. [92.77.218.103]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c0a844f728fsm96248066b.5.2026.06.19.08.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 08:11:13 -0700 (PDT) Date: Fri, 19 Jun 2026 17:11:11 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Ilmar Yunusov Cc: pgsql-hackers@lists.postgresql.org Subject: Re: File locks for data directory lockfile in the context of Linux namespaces Message-ID: <54uh7vhavffktp72dmjm7ms26lntxacnvpwuaitiez4izugdi6@emwc2yrpqwk2> References: <45swup77t7utfy33lu47mvkb4exzm3oeakz25abqxuvmsyzt3c@5umrpfgc3ypg> <178066304625.594057.12185296716401427152.pgcf@coridan.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <178066304625.594057.12185296716401427152.pgcf@coridan.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Fri, Jun 05, 2026 at 12:37:26PM +0000, Ilmar Yunusov wrote: > The following review has been posted through the commitfest application: > make installcheck-world: not tested > Implements feature: tested, passed > Spec compliant: not tested > Documentation: not tested > > Hi, > > I looked at v2, focusing on apply/build status and the PID namespace scenario > described in the cover letter. Thanks for the review and testing! > Is locking the socket lock file intentional here? If so, maybe the helper name, > comment, and fd tracking should reflect that broader scope. If not, perhaps the > new lock should be applied only for the isDDLock case; otherwise v2 changes > socket lockfile semantics too, not only postmaster.pid. It's been a while, quite frankly I don't remember. On the face of it, I think both the directory and socket lock files should be locked in the same way, since both are equally susceptible for the failure scenario described in this thread, even if the consequences of a failure are different. Let me do some renaming to clarify that. > While reading that code, I also noticed a small error-path issue: DataDirLockFD > starts as 0, but if fcntl(F_OFD_SETLK) fails with a non-EAGAIN error the code > only emits a warning and does not assign a duplicate fd. UnlinkLockFiles() > then closes DataDirLockFD unconditionally. Initializing it to -1, closing it > conditionally, and checking dup(fd) would make that path more explicit. Good point, I'll address this in the next version.