Skip to contentSkip to conversation

Don't clear FD at EBUSY error in loopcxt_setup_device()

PATCH Applied Stanislav Brabec 2 participants 2 messages May 27, 2014 – May 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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 <[email protected]>

---
 lib/loopdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/loopdev.c +1 -1
index 1fbb000..988f3d3 100644
@@ -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));
Signature · 13 lines
1.8.4.5

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
maintainer Applied
#1 lore raw
Quoted 2 lines · Stanislav Brabec
 lib/loopdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com