Skip to content

Commit df42ce6

Browse files
Eric Sandeendjwong
authored andcommitted
xfs: allow individual quota grace period extension
The only grace period which can be set in the kernel today is for id 0, i.e. the default grace period for all users. However, setting an individual grace period is useful; for example: Alice has a soft quota of 100 inodes, and a hard quota of 200 inodes Alice uses 150 inodes, and enters a short grace period Alice really needs to use those 150 inodes past the grace period The administrator extends Alice's grace period until next Monday vfs quota users such as ext4 can do this today, with setquota -T To enable this for XFS, we simply move the timelimit assignment out from under the (id == 0) test. Default setting remains under (id == 0). Note that this now is consistent with how we set warnings. (Userspace requires updates to enable this as well; xfs_quota needs to parse new options, and setquota needs to set appropriate field flags.) Signed-off-by: Eric Sandeen <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent e850301 commit df42ce6

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

fs/xfs/xfs_qm_syscalls.c

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -555,32 +555,40 @@ xfs_qm_scall_setqlim(
555555
ddq->d_rtbwarns = cpu_to_be16(newlim->d_rt_spc_warns);
556556

557557
if (id == 0) {
558-
/*
559-
* Timelimits for the super user set the relative time
560-
* the other users can be over quota for this file system.
561-
* If it is zero a default is used. Ditto for the default
562-
* soft and hard limit values (already done, above), and
563-
* for warnings.
564-
*/
565-
if (newlim->d_fieldmask & QC_SPC_TIMER) {
566-
defq->btimelimit = newlim->d_spc_timer;
567-
ddq->d_btimer = cpu_to_be32(newlim->d_spc_timer);
568-
}
569-
if (newlim->d_fieldmask & QC_INO_TIMER) {
570-
defq->itimelimit = newlim->d_ino_timer;
571-
ddq->d_itimer = cpu_to_be32(newlim->d_ino_timer);
572-
}
573-
if (newlim->d_fieldmask & QC_RT_SPC_TIMER) {
574-
defq->rtbtimelimit = newlim->d_rt_spc_timer;
575-
ddq->d_rtbtimer = cpu_to_be32(newlim->d_rt_spc_timer);
576-
}
577558
if (newlim->d_fieldmask & QC_SPC_WARNS)
578559
defq->bwarnlimit = newlim->d_spc_warns;
579560
if (newlim->d_fieldmask & QC_INO_WARNS)
580561
defq->iwarnlimit = newlim->d_ino_warns;
581562
if (newlim->d_fieldmask & QC_RT_SPC_WARNS)
582563
defq->rtbwarnlimit = newlim->d_rt_spc_warns;
583-
} else {
564+
}
565+
566+
/*
567+
* Timelimits for the super user set the relative time the other users
568+
* can be over quota for this file system. If it is zero a default is
569+
* used. Ditto for the default soft and hard limit values (already
570+
* done, above), and for warnings.
571+
*
572+
* For other IDs, userspace can bump out the grace period if over
573+
* the soft limit.
574+
*/
575+
if (newlim->d_fieldmask & QC_SPC_TIMER)
576+
ddq->d_btimer = cpu_to_be32(newlim->d_spc_timer);
577+
if (newlim->d_fieldmask & QC_INO_TIMER)
578+
ddq->d_itimer = cpu_to_be32(newlim->d_ino_timer);
579+
if (newlim->d_fieldmask & QC_RT_SPC_TIMER)
580+
ddq->d_rtbtimer = cpu_to_be32(newlim->d_rt_spc_timer);
581+
582+
if (id == 0) {
583+
if (newlim->d_fieldmask & QC_SPC_TIMER)
584+
defq->btimelimit = newlim->d_spc_timer;
585+
if (newlim->d_fieldmask & QC_INO_TIMER)
586+
defq->itimelimit = newlim->d_ino_timer;
587+
if (newlim->d_fieldmask & QC_RT_SPC_TIMER)
588+
defq->rtbtimelimit = newlim->d_rt_spc_timer;
589+
}
590+
591+
if (id != 0) {
584592
/*
585593
* If the user is now over quota, start the timelimit.
586594
* The user will not be 'warned'.

0 commit comments

Comments
 (0)