|
@@ -1,13 +1,11 @@
|
|
package aufs
|
|
package aufs
|
|
|
|
|
|
import (
|
|
import (
|
|
- "fmt"
|
|
|
|
"github.com/dotcloud/docker/utils"
|
|
"github.com/dotcloud/docker/utils"
|
|
"os"
|
|
"os"
|
|
"os/exec"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"syscall"
|
|
"syscall"
|
|
- "time"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
func Unmount(target string) error {
|
|
func Unmount(target string) error {
|
|
@@ -17,22 +15,7 @@ func Unmount(target string) error {
|
|
if err := syscall.Unmount(target, 0); err != nil {
|
|
if err := syscall.Unmount(target, 0); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- // Even though we just unmounted the filesystem, AUFS will prevent deleting the mntpoint
|
|
|
|
- // for some time. We'll just keep retrying until it succeeds.
|
|
|
|
- for retries := 0; retries < 1000; retries++ {
|
|
|
|
- err := os.Remove(target)
|
|
|
|
- if err == nil {
|
|
|
|
- // rm mntpoint succeeded
|
|
|
|
- return nil
|
|
|
|
- }
|
|
|
|
- if os.IsNotExist(err) {
|
|
|
|
- // mntpoint doesn't exist anymore. Success.
|
|
|
|
- return nil
|
|
|
|
- }
|
|
|
|
- // fmt.Printf("(%v) Remove %v returned: %v\n", retries, target, err)
|
|
|
|
- time.Sleep(10 * time.Millisecond)
|
|
|
|
- }
|
|
|
|
- return fmt.Errorf("Umount: Failed to umount %v", target)
|
|
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
|
|
|
|
func Mounted(mountpoint string) (bool, error) {
|
|
func Mounted(mountpoint string) (bool, error) {
|