[Buildd-tools-devel] Bug#391319: Bug#391319: schroot: leftover processes cause umount to fail

Roger Leigh rleigh at whinlatter.ukfsn.org
Mon May 28 12:17:30 UTC 2007


tags 391319 + fixed-upstream pending
thanks

Kees Cook <kees at outflux.net> writes:

> On Wed, May 23, 2007 at 08:38:15PM +0100, Roger Leigh wrote:
> This is already true.  If no proc items are found to kill, the function
> immediately exits.

Great.

>> I think the while loop needs some optimisation, such as checking if
>> the process has terminated so that it can break out of the loop early.
>> I think simply repeating the readlink inside the loop would be
>> sufficient.  So instead of "while kill", so "while readlink", and then
>> kill inside the loop.
>
> I was trading off between a 100% CPU spin on readlink vs 1 second
> granularity for each process that fails to immediately die.  As it is
> written, if the process dies immediately, the "kill -0" will fail and no
> waiting will be done.
>
>> Another nice addition would be to print out which processes are being
>> killed if in verbose mode.
>
> Is this valuable?  By the time the user sees the warning, the process is
> already dead.  Perhaps both the pid and the exe name?
>
> Attached is an improved patch.

This is fantastic.  I have separated it from 10mount, as 15killprocs
(it will always get run before 10mount on shutdown).  This is because
you might want to run it even if there are no filesystems to unmount.

I have tweaked it slightly in a few places, but it's otherwise the
same as your patch.  This is mainly using /proc/pid/root as well as
/proc/pid/exe (saves a grep invocation), and adding an additional log
message.  I also used signal names rather than numbers with kill (for
portability).  I also took the liberty of adding you to the AUTHORS
file for this contribution--I hope that's acceptable to you?

I have attached the patch I have just committed to SVN.  Is this OK,
or would you like any further changes making?


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: schroot-15killprocs.patch
Type: text/x-diff
Size: 4682 bytes
Desc: Kill processes in the chroot (SVN commit)
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20070528/0bcfa51f/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20070528/0bcfa51f/attachment.pgp 


More information about the Buildd-tools-devel mailing list