summaryrefslogtreecommitdiffstats
path: root/lib/loopdev.c
diff options
context:
space:
mode:
authorStanislav Brabec2014-05-27 20:38:10 +0200
committerKarel Zak2014-05-28 09:18:28 +0200
commitf7e21185087c30c5f13bf92009238e316f8c1cf4 (patch)
treec8274bc7f0b83f52d3b468ee2ee63d8f00c6be9c /lib/loopdev.c
parentlslogins: print systemd journal logs (diff)
downloadkernel-qcow2-util-linux-f7e21185087c30c5f13bf92009238e316f8c1cf4.tar.gz
kernel-qcow2-util-linux-f7e21185087c30c5f13bf92009238e316f8c1cf4.tar.xz
kernel-qcow2-util-linux-f7e21185087c30c5f13bf92009238e316f8c1cf4.zip
losetup: don't clear FD at EBUSY error in loopcxt_setup_device()
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>
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r--lib/loopdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c
index 1fbb000c4..988f3d337 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -1294,7 +1294,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc)
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));