From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 0D0481FF09B for ; Mon, 09 Nov 2026 08:59:55 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9EF0C215C6; Mon, 09 Nov 2026 08:59:50 +0100 (CET) From: Kefu Chai To: pve-devel@lists.proxmox.com Subject: [PATCH common v2 0/2] cmd: run: do not leave the command behind on a caller's timeout Date: Mon, 9 Nov 2026 15:59:36 +0800 Message-ID: <20261109075938.1737717-1-k.chai@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794211184995 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.229 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: DBPKTIDAR22PSZV7GZ73EP6CEZLVLNP5 X-Message-ID-Hash: DBPKTIDAR22PSZV7GZ73EP6CEZLVLNP5 X-MailFrom: k.chai@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: w.bumiller@proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi, a colleague ran 'pvesm alloc' on an RBD pool whose placement groups never became active: the storage lock gave up and got released, but 'rbd create' just kept running. Patch 2 kills and reaps the command after run's eval if it is still around. Patch 1 stops run() from cancelling the caller's alarm on its way out, which would let 'lvcreate' run without the lock's limit on shared LVM once 'vgs' ran before it. Changes since v1, from Wolfgang's review [1]: - patch 1: disable the caller's alarm before installing our own ALRM handler, so it cannot fire into the new handler right before our timeout is armed, which would have been reported as run's timeout - patch 1: run the flush of the last buffered stderr line in its own eval, since the caller's alarm can interrupt it now; its error is warned on a timeout and appended otherwise, with a new test Patch 2 is unchanged. I replied to the review [1] why I kept it a separate patch. Link to v1: https://lore.proxmox.com/pve-devel/20261021110126.4024539-1-k.chai@proxmox.com/ [1] https://lore.proxmox.com/pve-devel/cgsng52kirt4qcaehzqlb75kqttxcgjirdgum6ndwp7ym6ag2d@p254xv6gnjv4/ Kefu Chai (2): cmd: run: do not cancel the caller's alarm cmd: run: kill the command when run dies src/PVE/Cmd.pm | 90 ++++++++++++++++++++++++---------------------- test/cmd-test.pl | 85 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 132 insertions(+), 43 deletions(-) -- 2.47.3