New loop device code fix

Chris Evans (chris@ferret.lmh.ox.ac.uk)
Mon, 15 Sep 1997 23:56:00 +0100 (BST)


Hi,

I'm running 2.1.54 patched with the "loop-9" loop device code. I like the
way he encryption works :-) Does it use 128 bit keys by default? The
buffer/ll-rw-block code probably needs some review though as a large copy
to an encrypted loop device makes the system freeze for periods of a few
seconds. Running nicely though...

I did find one serious bug however that renders a loop device undetachable
the second time a given loop minor is used. The following little patch
should address the problem.

Patch is only relevaqnt on top of a loop patched kernel based on the
latest code.

Cheers
Chris

In linux/drivers/block

--- loop.c.old Mon Sep 15 22:38:28 1997
+++ loop.c Mon Sep 15 22:40:30 1997
@@ -5,6 +5,9 @@
* Redistribution of this file is permitted under the GNU Public License.
*
* HISTORY
+ * Sep 15, 1997 - Chris Evans <chris@ferret.lmh.ox.ac.uk>
+ * Fixed ref count problem in loop_clr_fd()
+ *
* May 3, 1997 - Andrew E. Mileski <aem@netcom.ca>
* Removed encryption (legal reasons) and other data transformations,
* and added the capability to have them all in modules. Fixed buffer
@@ -590,7 +593,7 @@
minor = ld->minor;
memset(ld, 0, sizeof(struct loop_device));
ld->minor = minor;
- ld->refcount = 2;
+ ld->refcount = 1;

MOD_DEC_USE_COUNT;
return 0;