]> www.infradead.org Git - users/dwmw2/linux.git/commit
gfs2: Fix and clean up function do_qc
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 5 Jun 2024 22:24:40 +0000 (00:24 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Sat, 8 Jun 2024 00:35:16 +0000 (02:35 +0200)
commit7da4d6e178f405d7abdfc42ea7ac0074e9a6aa45
treee0f86d5f825e671c1319533f9144c68fef2a3a4c
parentec4b5200c8af9ce021399d3192b3379c089396c3
gfs2: Fix and clean up function do_qc

Function do_qc() is supposed to be conceptually simple: it alters the
current in-memory and on-disk quota change values for a given uid/gid by
a given delta.  If the on-disk record isn't defined yet, a new record is
created.  If the on-disk record exists and the resulting change value is
zero, there no longer is a need for that record and so the record is
deleted.  On top of that, some reference counting is involved when
creating and deleting records.

Currently, instead of doing the above, do_qc() alters the on-disk value
and then it sets the in-memory value to the on-disk value.  This is
incorrect when the on-disk value differs from the in-memory value.  The
two values are allowed to differ when quota changes are synced to the
global quota file.  Fix by changing both values by the same amount.

In addition, do_qc() currently gets confused when the delta value is 0.
It isn't supposed to be called that way, but that assumption isn't
mentioned and it makes the code harder to read.  Make the code more
explicit.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/quota.c