tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Error (typo) in quotacheck(8)



Any quota experts round here?

There seems to be an obvious typo in quotacheck(8).
In update(), line 558 reads (indentation removed):

/*
 * Reset time limit if have a soft limit and were
 * previously under it, but are now over it.
 */
if (dqbuf.dqb_bsoftlimit &&
    dqbuf.dqb_curblocks < dqbuf.dqb_bsoftlimit &&
    fup->fu_curblocks >= dqbuf.dqb_bsoftlimit)
        dqbuf.dqb_btime = 0;
if (dqbuf.dqb_isoftlimit &&
    dqbuf.dqb_curblocks < dqbuf.dqb_isoftlimit &&
                 ^^^^^^
    fup->fu_curblocks >= dqbuf.dqb_isoftlimit)
               ^^^^^^
        dqbuf.dqb_itime = 0;
dqbuf.dqb_curinodes = fup->fu_curinodes;
dqbuf.dqb_curblocks = fup->fu_curblocks;

where the marked "blocks" should clearly be "inodes".
It would also seem more logically to me to reverse the order of the last two
assignments to keep the blocks/inodes order consistent.

While investigating that code, I had quite some trouble in finding out what
it was precisely meant to do.
My first impression was that quotacheck(8) wanted to avoid fiddling with the
time fields and rather leave that to the kernel, telling it to do so by zeroing
them out. Indeed, dqget() would set them to "now plus the grace period" if they
were zero.
But, besides no comment in the code that would indicate that that was expected
to happen, setuse(), contrary to setquota(), seems to ignore the usage
argument's time field, but sets the dq's values as expected in case the user
goes over quota with the usage change.
So the only thing we may end up ith is an inconsitency between the in-core
grace time and the one on-disk-copy, right?

While there, I found that in both setquota() and setuse(), the ndq variables
seem to be redundant.

Also, in chkdqchg, ncurblocks is (signed) long, while dq_curblocks is u_int32_t.
Is it possible for the value to become negative?
Sae goes for chkiqchg and ncurinodes.

Aditionally, the wording of man quotactl(2), Q_SETUSE, reads "Set disk usage
limits", where, at least to me as a non-native speaker, the "limits" seems
both superflous and confusing.

And, in both dqget() and setquota(), I don't quite understand the special
handling of dq_id being zero when manipulating the tine values.

Comments, anyone?



Home | Main Index | Thread Index | Old Index