From: Karel Zak Date: Thu, 23 Apr 2009 13:09:04 +0000 (+0200) Subject: losetup: mount endless loop hang X-Git-Tag: v2.15~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc08b4bb9d5997c0d65eec37b5c795ddbbbebd97;p=thirdparty%2Futil-linux.git 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 --- diff --git a/mount/lomount.c b/mount/lomount.c index 6b102925f7..d62198ef24 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