From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795629013; b=CqwNZSLTRmr4SmatIrJM2cQbLo1Le/pYzWCg8+qG/TtsYiZju56DRyKzf4SPP7NlRvw+ M//zYSS8NtKVdwVELrpEk75MdE5584vcsD+PDH+9lNSR0leiolOFOv292OpibgOdLHfgJ AfJ/rKeiCFXUUQBwg3yHpKo9KeM9aMWFF2Nc+xvgQmZFGksRgtKY+eCUShbciEWzC1meX pSsIX5iAVPcFTne4REFl+NBSv5ZiUgyhJ2hZAA7S+XUomuLsKL1FgQuuO64KlAt0EM7yz RlKDvfFtE5Bdp4YjPdsB6RAwHVe5EdMSwq7rBvCA47vV74OEMF3Fa2Db9R/7flK0o4Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795629013; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=iVdPOcw1bs6hdzSnoCmlTQe9oM25xdIMmK+wXSHKTBo=; b=hi/u/mkn15Zuah2f8SUEgbQ0BTJbV9PM2hPf5nsdBMoXA5G5zrU+g7ruJzuTnTlTy8ZX 5rsNpZ7S/GeSEe25jU9dQTLtqf0LTI+m1yj/aAXesacstY6wT61SmhRwsJgorFV8pucan 6LilJ+lYIeE0R+8aI207CgIuSSEP70A1AX5NEcjw160K3shnWkn6WRTIUJXuEG/3a4V/D 9Kmdmti1i77CC8t03CoYqYhAMef/Kx/Tw/379vr5F7SMBcp92fJZL/2tQqw23jF02fNqB VeJHPpMSnjmvEJxXZAdguKFIQ3T487SM/6UpN7Fa2F4bJkkd5I7/3A11XA19GbtP8kg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cs.unc.edu; spf=pass smtp.mailfrom=cs.unc.edu; dkim=pass header.d=cs.unc.edu header.i=@cs.unc.edu header.a=rsa-sha256 header.s=google header.b=VAa13JZp; arc=none smtp.remote-ip=209.85.128.169 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C13EC606A326 for ; Wed, 25 Nov 2026 17:50:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C13EC606A326 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cs.unc.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cs.unc.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cs.unc.edu header.i=@cs.unc.edu header.a=rsa-sha256 header.s=google header.b=VAa13JZp Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-8b360828905so56632627b3.2 for ; Wed, 25 Nov 2026 09:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.unc.edu; s=google; t=1795629012; x=1796233812; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=iVdPOcw1bs6hdzSnoCmlTQe9oM25xdIMmK+wXSHKTBo=; b=VAa13JZp07sBbOtWf3GoIBMIBQheUsIZTo3rZc0GmkeFHLHaPzAoIRZd7GdDmnRrRJ 3a3EO/RwOxQes9cJgDIvwhUr1psiHVxzS9QV4IISmDTLGCktmYY6IZgzxLA4FBa+FGDS soP+EpDUm4KUe9avhBaeI7zdedR4GdIObTjNQLG4RKn+7UPwCHaMCQ0xAdbQx4mcreMu AV9h4tGyOnXg0pL1/BbDlCA6KK538ImkSkkhNaOxG3eU1ojjwZs+SGbOaNzp4LweZvDN n+gdgxejXIxaDbctTrOng4qUiBRJ8JpiNV8Cud+pfPDHdJAz8KsZoq9JrP7yNm6XH3Bu miCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795629012; x=1796233812; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iVdPOcw1bs6hdzSnoCmlTQe9oM25xdIMmK+wXSHKTBo=; b=KFuOcVOjf+pSwlu3L1lI1P48WUm+OR5gi+l/Cf96tjO8Jt0ahLKP57TgDUWA2yolah 5d5zphFWozQOR8V8bpdUN9chQoHI5AS/l/fhCLIgKKrcr7UFxrsTQfjuavH85NQplpcc 6w0KfvyUEqK6ZhUFvKkNO6N8T5VDPGZ9BPPWB6XqwIxwIxiPW/qiJ3rkdeWjfSLHj8vc QqGKw6WrkOEtwqnJtlj1zZYrx6JwYurjddoFsT59lL7prQgoxggU4psqGqDCGKu4v/nz odYCygtXYkZaVgt+JMSoinp1Ig3uU7wjySh1t/zpcTZ6fOiUdf5g8kzI5KpSXgUlAxRl TI8Q== X-Forwarded-Encrypted: i=1; AL+hErGxkfdnIDSMvLz2p9cAVPoc2yHPdfIFZ34I84tJ8frXSEzOzAu559kNXyynLNVh8BoePyGiUbB/3Sqv440=@vger.kernel.org X-Gm-Message-State: APuU4Z/pO5mXGUVNSzSgW8aTg/HRcu3P42+NkOSFqfPyMthEYWG9kMum F2q1IuAl9ZDhd3wryf/sBIB0cjP9DY/+dvDgMV3s04bQ4QpRJcG45V9Yfk/8a+sx1g== X-Gm-Gg: AZFdTZdrGFogjYN0g0rsJjmaemjrUEGErA5e4U4CXop6Y/N+MdsjiyA0BMdHp+I+4+8 DCS5KCkKb6Aod+wJaS1N1R5LYqdnw7rB5NKBfPRTxa6A0+8SmhFROyryP6pRj3XDBY1l5oeXHs6 rU9FoXMbjOiAMWh3cbevm06jcNMp1MsrWUlgdslE/cbcCYfXxWsi7DlhXrp+v/zTobwcr2q19sh AoAWX485cdAyJScRZqE3ZYxyI1R+ve/e3hcmV0VYz/oL9K3HzAxGlFZ3AAcD1J2VsftYd1e7rl0 htv3iJQAF1S8R87EMJcMC/1GLMDx0vai61kg2sPsEjl66YSlHASiJF++Xmly4H6CPtfvYIJKGpO 4pA39w7UjIMCfCr1zVHr9KpuRwhKNW1dqODXISEZGE/HBycEDGwomc9Oipuq1kegJ0x2nMIHgJs exmD/j5RB3zhHQm2GvpUhFkWiOgIF31JDC+R3A8zfvI5bep1tRDIIRu0htIfLa8cxQVuZKYVEP3 FhFFE1F96DehZADh1LDTYylVNF6pR/s+3oOBFrWx2K8dRtju13YAKVTu3s5uXpKbrOHq68hEJPR D1cL2hJsEIfbha+LwlomvBbfzLQ+FabU1QVsS3xtVgt8m2CuZRY= X-Received: by 2002:a05:690c:4448:b0:8b2:e4cf:c399 with SMTP id 00721157ae682-8b520435b9emr76177847b3.18.1795629011607; Wed, 25 Nov 2026 09:50:11 -0800 (PST) Received: from cobra01.cs.unc.edu (cobra01.cs.unc.edu. [152.2.130.143]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b52034f7absm75322567b3.41.2026.11.25.09.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 09:50:11 -0800 (PST) From: Hengyu Liang To: Andreas Gruenbacher Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] gfs2: restart rename when a signal interrupts the glock wait Date: Wed, 25 Nov 2026 12:50:07 -0500 Message-ID: <20261125175007.3659558-1-hengyul@cs.unc.edu> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 11d763f0b0af ("gfs2: Retries missing in gfs2_{rename,exchange}") made gfs2_glock_async_wait() interruptible. It returns -EINTR when a signal is pending. However, -EINTR goes back to user space as it is, and the system call is not restarted. As of now, rename() and renameat2() on gfs2 fail with EINTR when a signal arrives while they wait for a glock, also when the signal only stops and continues the process. The issue can be reproduced with: mkfs.gfs2 -O -p lock_nolock -j 1 /dev/vda mount /dev/vda /mnt mkdir /mnt/a /mnt/b for i in $(seq 12000); do echo > /mnt/a/$i; done umount /mnt; mount /dev/vda /mnt mv /mnt/a/* /mnt/b/ & while kill -STOP $!; do kill -CONT $!; sleep 0.005; done Before commit 11d763f0b0af ("gfs2: Retries missing in gfs2_{rename,exchange}"), mv moves all 12000 files. After that commit, the result for 783 of the files is: mv: cannot move '/mnt/a/10' to '/mnt/b/10': Interrupted system call With this patch, mv moves all 12000 files again. This patch will return -ERESTARTSYS instead, as gfs2_statfs_slow() does for its glock wait, so that the system call is restarted. Fixes: 11d763f0b0af ("gfs2: Retries missing in gfs2_{rename,exchange}") Cc: stable@vger.kernel.org Signed-off-by: Hengyu Liang --- I found this while comparing the behavior of different kernel versions. I used an LLM to analyze the problem and to draft the patch and this message, and I analyzed the result myself. Since commit a098f26d3b80 ("gfs2: Get rid of sd_async_glock_wait"), signals are only checked while a glock is still pending, so fewer renames fail: 60 of the 12000 files on gfs2 for-next. The stable trees that have commit 11d763f0b0af do not have that one, so the change is a single line there. Application impact (Ubuntu 26.04 user space): rsync 3.4.1 updates 12000 small files on gfs2 while its processes are stopped and continued every 5 ms (kill -TSTP / -CONT). On v6.19, rsync exits with 0. On v7.0, it exits with 23 after 267 "rename ... Interrupted system call" errors, and those files keep their old content. Tested on gfs2 for-next (9aa0082cf969) with lock_nolock, KASAN and lockdep: rename, RENAME_EXCHANGE and directory renames no longer fail under a SA_RESTART handler or under stop / continue. A handler without SA_RESTART still gets EINTR. fs/gfs2/glock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index aa11168255e9..05e6b0f6ccc7 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1318,7 +1318,7 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs, if (!glocks_pending(num_gh, ghs)) break; if (signal_pending(current)) { - ret = -EINTR; + ret = -ERESTARTSYS; break; } ret = schedule_timeout(ret); @@ -1329,7 +1329,7 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs, break; } if (signal_pending(current)) { - ret = -EINTR; + ret = -ERESTARTSYS; break; } } @@ -1363,7 +1363,7 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs, return ret; interrupted: - ret = -EINTR; + ret = -ERESTARTSYS; goto out; } base-commit: 9aa0082cf969a9973ec6554586753c53211ab799 -- 2.53.0