diff options
| author | Ingo Molnar <mingo@kernel.org> | 2012-12-08 15:25:06 +0100 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2012-12-08 15:25:06 +0100 |
| commit | f0b9abfb044649bc452fb2fb975ff2fd599cc6a3 (patch) | |
| tree | 7800081c5cb16a4dfee1e57a70f3be90f7b50d9a /drivers/block/loop.c | |
| parent | adc1ef1e37358d3c17d1a74a58b2e104fc0bda15 (diff) | |
| parent | 1b3c393cd43f22ead8a6a2f839efc6df8ebd7465 (diff) | |
| download | cachepc-linux-f0b9abfb044649bc452fb2fb975ff2fd599cc6a3.tar.gz cachepc-linux-f0b9abfb044649bc452fb2fb975ff2fd599cc6a3.zip | |
Merge branch 'linus' into perf/core
Conflicts:
tools/perf/Makefile
tools/perf/builtin-test.c
tools/perf/perf.h
tools/perf/tests/parse-events.c
tools/perf/util/evsel.h
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/block/loop.c')
| -rw-r--r-- | drivers/block/loop.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e9d594fd12cb..54046e51160a 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo) if (lo->lo_state != Lo_bound) return -ENXIO; - if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ - return -EBUSY; + /* + * If we've explicitly asked to tear down the loop device, + * and it has an elevated reference count, set it for auto-teardown when + * the last reference goes away. This stops $!~#$@ udev from + * preventing teardown because it decided that it needs to run blkid on + * the loopback device whenever they appear. xfstests is notorious for + * failing tests because blkid via udev races with a losetup + * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d + * command to fail with EBUSY. + */ + if (lo->lo_refcnt > 1) { + lo->lo_flags |= LO_FLAGS_AUTOCLEAR; + mutex_unlock(&lo->lo_ctl_mutex); + return 0; + } if (filp == NULL) return -EINVAL; |
