busybox/util-linux
Denys Vlasenko 56ee576507 mount: fix incorrect "success" exitcode if loop device setup fails
When mounting, in parallel, multiple loop devices (squashfs for the
submitter's case), the following behavior can be observed:

stat64(/path/to/image, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
openat(AT_FDCWD, /path/to/image, O_RDWR|O_LARGEFILE) = 3
openat(AT_FDCWD, /dev/loop-control, O_RDWR|O_LARGEFILE|O_CLOEXEC) = 4
ioctl(4, LOOP_CTL_GET_FREE)             = 12
close(4)                                = 0
openat(AT_FDCWD, /dev/loop12, O_RDWR|O_LARGEFILE) = 4
ioctl(4, LOOP_GET_STATUS64, {lo_offset=0, lo_number=12, lo_flags=LO_FLAGS_AUTOCLEAR, lo_file_name=/path/to/image, ...}) = 0
close(4)                                = 0
close(3)                                = 0
write(2, "mount: can't setup loop device\n", 31mount: can't setup loop device
) = 31
exit_group(0)                           = ?
+++ exited with 0 +++

The ioctl LOOP_CTL_GET_FREE has resulted in the same result for
a competing mount process. The subsequent ioctl LOOP_GET_STATUS64
fails, having succeeded for the competing mount process.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-09 20:56:43 +01:00
..
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00
2020-11-15 20:26:46 +01:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00
2020-08-13 17:12:56 +02:00
2020-11-29 11:37:34 +01:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00
2018-12-28 03:20:17 +01:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2019-11-19 13:08:25 +01:00
2018-12-28 03:20:17 +01:00
2018-12-28 03:20:17 +01:00
2018-12-28 03:20:17 +01:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00
2018-12-28 03:20:17 +01:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00
2020-08-13 17:12:56 +02:00
2020-11-22 16:22:16 +01:00
2020-08-13 17:12:56 +02:00
2020-08-13 17:12:56 +02:00
2018-12-28 03:20:17 +01:00