All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] fix side effects of loop reuse
@ 2017-01-12 14:45 Stanislav Brabec
  2017-01-16 11:29 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Brabec @ 2017-01-12 14:45 UTC (permalink / raw)
  To: util-linux

Detailed testing discovered some regressions in the loop reuse code:


1) mount -oloop=/dev/loop1 changed its behavior

Note that the proposed solution keeps overlay checks active. There is
another possible solution: disable all checks:

--- a/libmount/src/context_loopdev.c
+++ b/libmount/src/context_loopdev.c
@@ -215,7 +215,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
 	 * mechanism to detect it. To prevent data corruption, the same loop
 	 * device has to be recycled.
 	*/
-	if (backing_file) {
+	if (backing_file && !loopval) {
 		rc = loopcxt_init(&lc, 0);
 		if (rc)
 			goto done_no_deinit;

There is still a small regression that could be fixed in the future:
If both the existing and the requested devices are read-only, it is
safe to not reuse existing loop device.

So we can think about allowing of:
losetup --read-only /dev/loop0 file.img
mount -oro,loop=/dev/loop1 file.img /mnt

2) If mount re-uses an existing loop device, then the loop device is
detached, even if autoclean flag is off.

Note that I was not able to find a mechanism, how mount gets the "loop"
in the output, so I did the change in mount, and not umount.


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          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	[flat|nested] 2+ messages in thread

* Re: [PATCH 0/3] fix side effects of loop reuse
  2017-01-12 14:45 [PATCH 0/3] fix side effects of loop reuse Stanislav Brabec
@ 2017-01-16 11:29 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2017-01-16 11:29 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux

On Thu, Jan 12, 2017 at 03:45:07PM +0100, Stanislav Brabec wrote:
> -	if (backing_file) {
> +	if (backing_file && !loopval) {

This is not so bad solution, if you use -oloop=/dev/loopN you probably
know what are you doing :-)

Anyway, all the three patches applied. Thanks (and extra thank for the
tests).

    Karel


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

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

end of thread, other threads:[~2017-01-16 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 14:45 [PATCH 0/3] fix side effects of loop reuse Stanislav Brabec
2017-01-16 11:29 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.