util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Don't clear FD at EBUSY error in loopcxt_setup_device()
@ 2014-05-27 18:38 Stanislav Brabec
  2014-05-28  7:19 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Brabec @ 2014-05-27 18:38 UTC (permalink / raw)
  To: util-linux; +Cc: Takashi Iwai

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>
---
 lib/loopdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/loopdev.c b/lib/loopdev.c
index 1fbb000..988f3d3 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));
-- 
1.8.4.5

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] Don't clear FD at EBUSY error in loopcxt_setup_device()
  2014-05-27 18:38 [PATCH 1/2] Don't clear FD at EBUSY error in loopcxt_setup_device() Stanislav Brabec
@ 2014-05-28  7:19 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-05-28  7:19 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux, Takashi Iwai

On Tue, May 27, 2014 at 08:38:10PM +0200, Stanislav Brabec wrote:
>  lib/loopdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-28  7:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-27 18:38 [PATCH 1/2] Don't clear FD at EBUSY error in loopcxt_setup_device() Stanislav Brabec
2014-05-28  7:19 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).