[buildd-tools-devel] Bug#593516: Bug#593516: Bug#593516: schroot: race condition in /proc/mounts can break cleanup

Roger Leigh rleigh at codelibre.net
Sat Aug 21 21:50:00 UTC 2010


tags 593516 + fixed-upstream pending
thanks

On Thu, Aug 19, 2010 at 08:54:38PM -0400, Greg Price wrote:
> On Thu, Aug 19, 2010 at 3:21 PM, Roger Leigh <rleigh at codelibre.net> wrote:
> >> Currently I'm working around the issue with a flock around the body of
> >> do_umount_all().  That's easy and is enough to address the problem
> >> when no other umounts are happening on the system.
> >
> > If you would like this fix including, I'll be happy to accept a
> > patch implementing this.  Are you doing this in the shell script?
> > If it's possible to directly lock /proc/mounts with fcntl this could
> > be addressed directly in schroot-listmounts using sbuild::file_lock,
> > which wraps fcntl.
> 
> Sure, patch copied below.  It's not possible for userspace to directly
> lock /proc/mounts; the best we can do is an advisory lock that we
> ourselves respect.  So I placed a flock around the invocations of both
> schroot-listmounts and umount, which are the only such invocations in
> the schroot source tree.

This is ideal, and I've included your patch on the schroot-1.4 branch

http://git.debian.org/?p=buildd-tools/schroot.git;a=commitdiff;h=806466870c810332fc6a5e932598e339029992bf
http://git.debian.org/?p=buildd-tools/schroot.git;a=commitdiff;h=8a65a3426da512bba036f4ac02ee588765e1bcc4

I've just altered the patch to add a comment about the purpose of the
lock.  I've also altered the lock name to /var/log/schroot-umount
to prevent conflicts with others since it's in our namespace.

> > Has a bug report been filed against the Linux kernel or on the
> > kernel mailing list?  A fix in the kernel would be ideal, and they
> > should probably also be notified.
> 
> I haven't filed such a bug.  I'm debating whether to send a message to
> the LKML.  Honestly, I suspect this will follow many other well-loved
> quirks in that it is difficult to fix, and the best solution to hope
> for may be for more people to be aware of it and handle it with
> strategies like the separate-namespace approach you suggest.  Maybe
> I'll mail the LKML with a strawman patch, and see if someone can prove
> me wrong. =)

In the meantime I duplicated this bug as #593883 and assigned it
to linux-2.6.  At least the Debian kernel team will be aware of it.


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: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20100821/827ae3c7/attachment.pgp>


More information about the Buildd-tools-devel mailing list