From mboxrd@z Thu Jan 1 00:00:00 1970 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=1794591064; b=h//xhDk2fDZa8iEeTc8aCkS2dxhMpc7v+ef7PBjq5kiIvnVrSDJA4n7TFeNPypIKY2jm DQcK3F/iHZvIgG7nQu7XIlvABTkKt+LB4DidONvhyHqs23GFb2jFnNKsnGoawpqi5ZGs8 uNeIhpiSnmb50Nb+buHD4SXIxgYhOaCcQWU663gMSgafEJ+xymM+gKeOTO2YX2Y4gYX03 zy+ACQAYUMeQRfv5H0epcO2C14CWNLKiCYP7HDzjjVFBdk0YP9v8+WRpuakxizTej6VDh 1x46wsOMMXMj5t9O3NwNej900JoJvIFCuf+x1QCK2mFVyi/quCmvHpR+a0d3nakWxcA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794591064; 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=su7QOaa/lJ50M0dVgr9K/qYlxDwKdJ/+bl2MlfZKzR0=; b=35SIR6DbneeHQcoUL3c4Q/4LWmqQaxvLzE3BQ/gskpLhp8K7LBaOdI4sTX0chj1jUWv6 S2kma3ZMsPcibck9p8nuBV2UBPPf8ODXy6CrS+fdZ4t34UTr2dKVqKBGhhRYqF3I92SJ3 /MYtj6za9He6rXslUWvWeaDe1LmPJ1ToCoTpD0QTJAhw+YxfGB8kLtGAvV4Vea7lnM5cg /pVHBOPZ8XCU9ZDIpmYXZPKCApWup5U41fQYB9FmpNZ3Ad/nPvhLr9pMzIsT8uTV+aFRF uw6RcJ7bX+xshnhiv7YWekkxY9Wn1rQ4dmxbrGOIz88qZ8vv1pOua6vGdp3VgspAnyQ== 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=wjo+gXSj; 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 62A09606B83B; Fri, 13 Nov 2026 17:31:04 +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=wjo+gXSj Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE6441F000C4; Fri, 13 Nov 2026 17:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794591064; bh=su7QOaa/lJ50M0dVgr9K/qYlxDwKdJ/+bl2MlfZKzR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wjo+gXSjplvj1mtJBbwjU4p0sdOIiwJJv/8eQSzTRxKwupUok/nU14XZGD1RCbUeI CbOzLeoOCaoMhnPqNS/AZm61XejU7G1t3XqVOGMkBG8aA2g43ZYx9EB6ToA4TovUyS 8vRMgHAat2gRATRJ13CHeOfxWJhZ8a9BpF3d9OgM= 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.12 223/670] tmpfs: keep the quota soft limits of an unused id Date: Fri, 13 Nov 2026 10:46:27 -0500 Message-ID: <20261113153819.440688271@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261113153811.177190860@linuxfoundation.org> References: <20261113153811.177190860@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@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 6.12-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 d1e32ac01407a..a359e8cceedb4 100644 --- a/mm/shmem_quota.c +++ b/mm/shmem_quota.c @@ -251,6 +251,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