cowbuilder deletes bind-mounted directories

Bug #1156540 reported by Jean-Baptiste Lallement
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cowdancer (Debian)
Fix Released
Unknown
cowdancer (Ubuntu)
Fix Released
Critical
Brian Murray

Bug Description

If cowbuilder failed to unmount a bind-mounted directory (device busy for example) it unconditionally deletes its content during the clean-up phase.

Excerpt from a log with this bug (complete log attached)
=====
I: umounting /var/lib/jenkins/cu2d
umount: /var/cache/pbuilder/build/cow.15281/var/lib/jenkins/cu2d: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[...]
 -> Cleaning COW directory
  forking: rm -rf /var/cache/pbuilder/build//cow.1195
rm: cannot remove `/var/cache/pbuilder/build//cow.1195/var/cache/pbuilder/ccache': Device or resource busy
rm: cannot remove `/var/cache/pbuilder/build//cow.1195/var/lib/jenkins/cu2d/work/experimental/100scopes': Device or resource busy
rm: cannot remove `/var/cache/pbuilder/build//cow.1195/var/lib/jenkins/cu2d/launchpad.cache': Directory not empty
=====

The 'rm' command must skip directories on other filesystems

This bug occurs when pbuilder fails to mount a bindmounted directory, then fails to unmount previously successfully mounted directories. This condition is not so rare when executing several cowbuilder processes in parallel using the same bind-mounted directories.

There is no easy way to reproduce this issue:
- Start several cowbuilder in parallel (in our system we run around 40) and bind mount the same source directories
- patch /usr/lib/pbuilder/pbuilder-modules lines 275 to 291 to fail on 2nd bindmount then fail when it tries to unmount one of the successfully mounted directory.

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: cowbuilder 0.71
ProcVersionSignature: Ubuntu 3.8.0-12.21-generic 3.8.2
Uname: Linux 3.8.0-12-generic x86_64
ApportVersion: 2.9.1-0ubuntu1
Architecture: amd64
Date: Mon Mar 18 11:08:38 2013
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cowdancer
UpgradeStatus: Upgraded to raring on 2012-01-31 (411 days ago)

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :
Changed in cowdancer (Ubuntu):
importance: Undecided → Critical
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

This patch checks if a directory is mounted under the chroot and skips rmrf() if there is one.

description: updated
description: updated
description: updated
Changed in cowdancer (Debian):
status: Unknown → New
summary: - cowdancer deletes bind-mounted directories
+ cowbuilder deletes bind-mounted directories
Changed in cowdancer (Ubuntu):
status: New → Triaged
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Brian Murray (brian-murray) wrote :

I updated the changelog for raring and ran update-maintainer to change Maintainer to Ubuntu Developers before uploading your patch. Thanks for the fix.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cowdancer - 0.71ubuntu1

---------------
cowdancer (0.71ubuntu1) raring; urgency=low

  * A directory bind-mounted into pc->buildplace, will be cleaned out by
    rmrf() To avoid this disaster, we skip buildplace clean-up if a directory
    is bind-mounted under the chroot (LP: #1156540)
 -- Jean-Baptiste Lallement <email address hidden> Tue, 19 Mar 2013 09:35:26 +0100

Changed in cowdancer (Ubuntu):
status: Triaged → Fix Released
Changed in cowdancer (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.