From: Josef Bacik 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 [ david: slightly adjusted description ] Signed-off-by: David Hildenbrand (Arm) --- mm/shmem_quota.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/shmem_quota.c b/mm/shmem_quota.c index a3fa4bd93e753..43d3b4fd6cb1b 100644 --- a/mm/shmem_quota.c +++ b/mm/shmem_quota.c @@ -256,6 +256,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.43.0