loopback lib clears the existing FD unconditionally at error in
loopcxt_setup_device(). This is done even after EBUSY, thus the second call
actually clears the previous setup wrongly.
Author: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
err:
if (file_fd >= 0)
close(file_fd);
- if (dev_fd >= 0)
+ if (dev_fd >= 0 && rc != -EBUSY)
ioctl(dev_fd, LOOP_CLR_FD, 0);
DBG(lc, loopdev_debug("setup failed [rc=%d]", rc));