[PATCH] small 2.4 (2.2?) change for loopback

From: Andreas Dilger (adilger@turbolinux.com)
Date: Wed Aug 02 2000 - 19:12:29 EST

Alan, Linus,
please consider the following micro-patch for 2.2 and/or 2.4 loopback
devices. It forces a re-scan of the loopback device size when BLKGETSIZE
ioctl is called, in case the underlying device/file size has changed.
This is important if, for example, an LVM device is mounted via loopback
and then resized under the loopback driver, but may also happen if a file
that is being used for a loop device is appended to. If the loop driver
does not re-scan the size, it will continue to report the original size of
the device.

Because BLKGETSIZE is not on the path for device I/O, it should not impact
performance at all, and in normal circumstances has no impact on loop devs.

Cheers, Andreas
--- cut here ---
diff -burN drivers/block/loop.c.orig drivers/block/loop.c
--- drivers/block/loop.c.orig Thu Feb 10 13:25:05 2000
+++ drivers/block/loop.c Thu Feb 10 13:25:15 2000
@@ -642,6 +642,7 @@
                         return -ENXIO;
                 if (!arg)
                         return -EINVAL;
+ figure_loop_size(lo); /* In case device changed (e.g. LVM) */
                 return put_user(loop_sizes[lo->lo_number] << 1, (long *) arg);
                 return lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
--- cut here ---

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Mon Aug 07 2000 - 21:00:10 EST