summaryrefslogtreecommitdiffstats
path: root/mount/lomount.c
diff options
context:
space:
mode:
authorKarel Zak2009-04-23 15:09:04 +0200
committerKarel Zak2009-04-23 15:09:04 +0200
commitfc08b4bb9d5997c0d65eec37b5c795ddbbbebd97 (patch)
tree014818f66759ef9f0e697053013cb7adb9447475 /mount/lomount.c
parentionice: change Jens Axboe's email (diff)
downloadkernel-qcow2-util-linux-fc08b4bb9d5997c0d65eec37b5c795ddbbbebd97.tar.gz
kernel-qcow2-util-linux-fc08b4bb9d5997c0d65eec37b5c795ddbbbebd97.tar.xz
kernel-qcow2-util-linux-fc08b4bb9d5997c0d65eec37b5c795ddbbbebd97.zip
losetup: mount endless loop hang
Based on fix-hang-on-stale-nfs.diff from SUSE src.rpm package. It seems better to more precisely check for ENXIO rather than assume that all LOOP_GET_STATUS errors mean that the device is not used. Addresses-Novell-Bugzilla: #449646 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/lomount.c')
-rw-r--r--mount/lomount.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mount/lomount.c b/mount/lomount.c
index 6b102925f..d62198ef2 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -97,7 +97,11 @@ static int
is_loop_used(int fd)
{
struct loop_info li;
- return ioctl (fd, LOOP_GET_STATUS, &li) == 0;
+
+ errno = 0;
+ if (ioctl (fd, LOOP_GET_STATUS, &li) < 0 && errno == ENXIO)
+ return 0;
+ return 1;
}
static int