diff options
| author | Tejun Heo <tj@kernel.org> | 2012-11-06 15:26:23 -0500 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2012-11-06 15:26:23 -0500 |
| commit | 5b805f2a7675634fbdf9ac1c9b2256905ab2ea68 (patch) | |
| tree | ee00d1e3d757458d66209b926d274491c6c3f61c /drivers/block/loop.c | |
| parent | 1db1e31b1ee3ae126ef98f39083b5f213c7b41bf (diff) | |
| parent | 201e72acb2d3821e2de9ce6091e98859c316b29a (diff) | |
Merge branch 'cgroup/for-3.7-fixes' into cgroup/for-3.8
This is to receive device_cgroup fixes so that further device_cgroup
changes can be made in cgroup/for-3.8.
Signed-off-by: Tejun Heo <tj@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) | |||
| 976 | if (lo->lo_state != Lo_bound) | 976 | if (lo->lo_state != Lo_bound) |
| 977 | return -ENXIO; | 977 | return -ENXIO; |
| 978 | 978 | ||
| 979 | if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ | 979 | /* |
| 980 | return -EBUSY; | 980 | * If we've explicitly asked to tear down the loop device, |
| 981 | * and it has an elevated reference count, set it for auto-teardown when | ||
| 982 | * the last reference goes away. This stops $!~#$@ udev from | ||
| 983 | * preventing teardown because it decided that it needs to run blkid on | ||
| 984 | * the loopback device whenever they appear. xfstests is notorious for | ||
| 985 | * failing tests because blkid via udev races with a losetup | ||
| 986 | * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d | ||
| 987 | * command to fail with EBUSY. | ||
| 988 | */ | ||
| 989 | if (lo->lo_refcnt > 1) { | ||
| 990 | lo->lo_flags |= LO_FLAGS_AUTOCLEAR; | ||
| 991 | mutex_unlock(&lo->lo_ctl_mutex); | ||
| 992 | return 0; | ||
| 993 | } | ||
| 981 | 994 | ||
| 982 | if (filp == NULL) | 995 | if (filp == NULL) |
| 983 | return -EINVAL; | 996 | return -EINVAL; |
