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=1794590250; b=26pSOIVqN2qdYLe/kRMyTE3JExZSzTxKWaWAAivz3QtG/kG7sPazGmChfohp2Yz8pguc 2i+yfW2iUSsPBgd81HwiVue7bV9zSUD9lMjEUA2rHwgqJMkcXp0v6X5cs1dbAWMLdF9la JKn/P0EF67d0zb2i+YDM8RfpXnLefuf36W+CxZ21Yvx6Kr4US+xlfcIhXdGIF8vgZl4ux 15qGV7B3eL8Th7qc2M5oI8k+jdxzwJfpVQ0Kqm/GQj/dS5pEUkbKl2yyLCk1gp862tocU UHA84biotHWuBT5r4Moxu8eIWqaaaWb2RO5qjFRPIn/hnLZfK7oFs/SlPsmKgHgZ7wA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794590250; 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=nUtRji1pOau2HH+I5zLqEWz3xvKb580WkLluaVyLQxY=; b=OaHLFYPv5YIbz/EZGa9CZuzm7KMPsTCjFMCJ4hDe8BpjDWJSZH1FFG2mTThrpVYCdpB9 CEaEfdnc5mRiwGRr8EzV+U/r8L/tvAiIkapcvlS9a0zuDv//g8rIxGUaWE8NIGFIRi91A 0jU19gSsf2nPmajSKPlJki1nxlBX07UIv0SZiBp3/Um7WmdZ5AxsyiIMKGVpHigy4nn13 WF1PFzqOcQdzzzppNQTbYIzSFZgyWdtQbAEzYmD5CX0+CtGoAusdfKS52MSPEhVfM+9e1 wYkqrkym8TtES9fNnxXQJo2kuyp3iQayoywuFY7j5vyFT2bS7z47dMdChnklfhw2Cig== 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=j88d3zlP; 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 99F7F6075E36; Fri, 13 Nov 2026 17:17:30 +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=j88d3zlP Received: by smtp.kernel.org (Postfix) with ESMTPSA id 464D41F000C4; Fri, 13 Nov 2026 17:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794590250; bh=nUtRji1pOau2HH+I5zLqEWz3xvKb580WkLluaVyLQxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j88d3zlP81hLy/1JOvG22M9ngCJuiZSd+dJh6CFWE31iwEaU8FL/aTh72UCRmRxdK Hiqs1tNPqZqo9nU7liL6GVwoLlkijWIriyS3anBYHRXXk086GtzcqKGJXWPwnhWkht v9zeXTZaCmHSSeff211Sh03waPFARmo+F9qDf9NA= 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.18 247/686] tmpfs: keep the quota soft limits of an unused id Date: Fri, 13 Nov 2026 10:46:20 -0500 Message-ID: <20261113153829.417264152@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261113153820.902362109@linuxfoundation.org> References: <20261113153820.902362109@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.18-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