mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
tmpfs: keep the quota soft limits of an unused id
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: de4c0e7ca8 ("shmem: Add default quota limit mount options")
Cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Tested-by: Gregory Price (Meta) <gourry@gourry.net>
[ david: slightly adjusted description ]
Link: https://patch.msgid.link/20261029-fixes_shmem-v4-2-392fc715d8f6@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
This commit is contained in:
parent
68b2aa37af
commit
968d734630
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user