[PATCH] Fix for /dev/loop in 2.3

Alexander Viro (viro@math.psu.edu)
Sun, 5 Dec 1999 15:23:50 -0500 (EST)


We have a problem with /dev/loop handling in 2.3 -
invalidate_inode_pages() leaves the buffer cache aliases around. Suppose
we have a dirty page waiting to be written to disk.
block_write_partial_page() made a bunch of buffers dirty, with
end_buffer_io_sync as a completion hook. generic_file_write() unlocked the
page without waiting and when we call invalidate_inode_pages() from
loop_set_fd() the page is tossed out of inode's pagecache (it's unlocked),
left around (it has buffers) and we got a situation with dirty buffers
filed. Fix follows:

--- drivers/block/loop.c Sun Nov 7 15:20:16 1999
+++ drivers/block/loop.c.new Sun Dec 5 15:12:49 1999
@@ -425,7 +425,7 @@
lo->lo_flags |= LO_FLAGS_READ_ONLY;
set_device_ro(dev, 1);
} else {
- invalidate_inode_pages (inode);
+ vmtruncate (inode, 0);
set_device_ro(dev, 0);
}
Cheers,
Al

-
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/