On 5/18/20 2:24 PM, Eric Sandeen wrote: > The only grace period which can be set via xfs_quota 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 > > xfs_quota can now accept an optional user id or name (symmetric with > how warn limits are specified), in which case that user's grace period > is extended to expire the given amount of time from now(). > > To maintain compatibility with old command lines, if none of > [-d|id|name] are specified, default limits are set as before. > > (kernelspace requires updates to enable all this as well.) > > Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> > + /* > + * If id is specified we are extending grace time by value > + * Otherwise we are setting the default grace time > + */ > + if (id) { > + time_t now; > + > + if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) { > + exitcode = 1; > + fprintf(stderr, _("%s: cannot get quota: %s\n"), > + progname, strerror(errno)); > + return; > + } > + > + time(&now); > + > + if (d.d_blk_hardlimit && d.d_bcount > d.d_blk_hardlimit) > + d.d_btimer = now + value; > + if (d.d_ino_softlimit && d.d_icount > d.d_ino_softlimit) > + d.d_itimer = now + value; > + if (d.d_rtb_softlimit && d.d_rtbcount > d.d_rtb_softlimit) > + d.d_rtbtimer = now + value; realized this might need some clarity (probably a comment). The idea is that we don't extend (i.e set) grace period unless the user is already into their grace period. setquota -T does the same thing: if (q->dq_dqb.dqb_bsoftlimit && toqb(q->dq_dqb.dqb_curspace) > q->dq_dqb.dqb_bsoftlimit) q->dq_dqb.dqb_btime = toset.dqb_btime; else errstr(_("Not setting block grace time on %s because softlimit is not exceeded.\n"), q->dq_h->qh_quotadev); Ugh, but also just realized I have a hardlimit/softlimit typo in there, will resend. -Eric