|
Description
|
[dep, 30Jun2004]
See comments.
[dp: Bite size bug with no description; fixing]
[dep, 30Jun2004]
kadmin will take ualock on A_SHUTDOWN:
104 int
105 kadmin(int cmd, int fcn, void *mdep, cred_t *credp)
106 {
...
136 /*
137 * Serialize these operations on ualock. If it is held, just return
138 * as if successful since the system will soon reset or remount.
139 */
140 if (cmd == A_SHUTDOWN || cmd == A_REBOOT || cmd == A_REMOUNT) {
141 if (!mutex_tryenter(&ualock))
142 return (0);
143 locked = 1;
144 }
which it normally drops before returning:
296 if (locked)
297 mutex_exit(&ualock);
298
299 return (error);
300 }
However, there is one case where it returns immediately:
146 switch (cmd) {
147 case A_SHUTDOWN:
148 {
149 proc_t *p = ttoproc(curthread);
...
156 if (ttoproc(curthread) != &p0) {
157 if ((error = exitlwps(0)) != 0)
158 return (error);
Since we take the lock with a tryenter, I believe the only side
effect of this is that subsequent attempts to A_SHUTDOWN, A_REBOOT,
or A_REMOUNT will fail.
Incidentally, because of the potential failure in the shutdown case,
the comment on lines 137-138 is incorrect. Waiting on a cv might be
preferable to the current locking scheme.
|