]> err.no Git - util-linux/commitdiff
losetup: mount endless loop hang
authorKarel Zak <kzak@redhat.com>
Thu, 23 Apr 2009 13:09:04 +0000 (15:09 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Apr 2009 13:09:04 +0000 (15:09 +0200)
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>
mount/lomount.c

index 6b102925f764f8e6cc47c0bbdeae1c730c336a0b..d62198ef242701db9ae100a0d30107b67bdc6ae3 100644 (file)
@@ -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