Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795037557; b=MDDMIFNTWRl5leX+vzIodvA/GHSG0kWb8NXKk2RHqzV14cNSgYNZE/MFkITTM6M41hsk Zw6ZrHYkcnK9Rb15k+VgKAvKOkcSwTEOYMD8QWH/BE20R43FBe6dtb7c9n0GVmH35owWp 9lGG1NNs8WS2HLNNy9RQDm82a2M5Ujept0wlo0F8POzy5Qz/tn7m+DjbYNQHunqIku80Q Ha01Pm1MWga8waCqKtj0ra+7dz2LbPVNCpuIyhd1rXhZHEqdyXErF8xn6ZZC+j5ZAvUPV DGkI5gRWwiji7jQFNt9KLDCK54rQiR0ji5BQOTvqWZj2RfDJeWSSLjisIR92Ljvp6vQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795037557; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=5cZSkGt+qK+fB+QNNfkbzAThGqto8UOPbDmbee5s8Wc=; b=PvkhzgJ7i1ns2Fb0b51UScHB71P1H/ja3UfV6ElmwPCJBfWQvYCc/9w+KTAFyTGoQtBG uFebf82d/q1BYU0mEcrne63Q+dVb7hcNsNLEDDbyhvMBGYA57mvEgHLG+WpBywwDHlwh/ yHVHH+QdG+j0qfLct6DrbFHz6s4bYjFi355eBM5CMq2DBiavHZfrvhRipZHE7DUXX0sW4 Nu9ZA8F2zxnmoJPxb/g+bqV8NeMdvZyyudsGQm/MVF/F2eeE/hRdFx2QgsxyfM8g1dAQe +mFo1mzaII0P1bI5nOHlgRB5dm+qTqBxw80dsZl6ItqLjpIIiaxjAWPbnMxFXrqLDjQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SpMYo5gD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA681606A325; Wed, 18 Nov 2026 21:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SpMYo5gD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C1AA1F000C4; Wed, 18 Nov 2026 21:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795037557; bh=5cZSkGt+qK+fB+QNNfkbzAThGqto8UOPbDmbee5s8Wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SpMYo5gDTXZzMGdu6388gE84HPom1FvykCxEzrhKw57XOPmakruDwba6jmGtxg+Lu LtnIxp2T97Q7ecD5fRwls88hh7cArOF4TfIUyqmdhmyilApPeLyj4LEV9iS/Yhyetq vjNYLtxkmDcaFWFZ2Nk3GZzMmWOTpWSTLqEQdzjc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Josef Bacik , Jan Kara , "Gregory Price (Meta)" , "David Hildenbrand (Arm)" , Sasha Levin Subject: [PATCH 6.6 1440/3318] tmpfs: keep the quota soft limits of an unused id Date: Wed, 18 Nov 2026 15:34:22 +0100 Message-ID: <20261118150404.014709271@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik [ Upstream commit 968d73463059156e1b89bfa6b189acd7d27197b2 ] When the last reference to a dquot goes away, shmem_release_dquot() stores its limits in the rb tree of the mount, unless shmem_is_empty_dquot() says that there is nothing worth storing. That function looks at the usage and at the two hard limits only. So if the administrator sets nothing but soft limits for an id that owns no file yet, the entry is thrown away as soon as the dquot that Q_SETQUOTA used is released, and the id never gets to see a limit. To fix it, compare the soft limits as well: an entry can be empty only if both soft limits are zero as well, which is exactly what shmem_acquire_dquot() sets for a new entry. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: de4c0e7ca8b5 ("shmem: Add default quota limit mount options") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik Reviewed-by: Jan Kara Tested-by: Gregory Price (Meta) [ david: slightly adjusted description ] Link: https://patch.msgid.link/20261029-fixes_shmem-v4-2-392fc715d8f6@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin --- mm/shmem_quota.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/shmem_quota.c b/mm/shmem_quota.c index ce514e700d2f6..23589d18a532a 100644 --- a/mm/shmem_quota.c +++ b/mm/shmem_quota.c @@ -253,6 +253,8 @@ static bool shmem_is_empty_dquot(struct dquot *dquot) if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || (dquot->dq_dqb.dqb_curspace == 0 && dquot->dq_dqb.dqb_curinodes == 0 && + dquot->dq_dqb.dqb_bsoftlimit == 0 && + dquot->dq_dqb.dqb_isoftlimit == 0 && dquot->dq_dqb.dqb_bhardlimit == bhardlimit && dquot->dq_dqb.dqb_ihardlimit == ihardlimit)) return true; -- 2.53.0