Commit b920686
committed
fsal: enforce folder quota on write/remove/truncate/rename
Wires the QuotaManager into the mutating FSAL operations that can
change tracked byte usage. Writes check the net new bytes up front
and adjust the counter by the real delta after the write completes,
so overwrites don't double-count. Remove captures the file size
before unlink and releases it afterwards. setattr_size releases
space when truncating down; extend is left alone since sparse files
don't consume real bytes and the subsequent write() will be caught.
Rename is a no-op within a single quota directory; across quota
directories it checks the target's budget up front and transfers
the usage atomically with the filesystem rename.
NFS handlers for WRITE, SETATTR and RENAME now map the FSAL's
"Quota exceeded" error to NFS3ERR_DQUOT (69), letting Linux clients
surface the condition as EDQUOT instead of a generic ENOSPC.
Also adds internal helpers quota_target / quota_dir_of on
LocalFilesystem and a free-standing path_size that recursively sums
file bytes under a directory for the cross-quota rename case.
Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>1 parent 8743bd5 commit b920686
4 files changed
Lines changed: 811 additions & 24 deletions
0 commit comments