Corruption caused by umount not flushing the buffer cache.

James Bottomley James.Bottomley en columbiasc.ncr.com
Mar Ene 25 04:00:18 CST 2000


There's a problem in 2.2.14 (and possibly 2.3.40) caused by do_umount (in 
fs/super.c) calling invalidate_inodes() but not invalidate_buffers(). I 
believe this only affects storage which is shared between boxes either on a 
SCSI bus or a SAN, but it's biting me:

If I mount the filesystem on Node A, modify it and unmount it.  Then I mount 
the same filesystem on Node B, modify it and unmount it.  Finally I mount it 
again on node A; because the buffers weren't invalidated on Node A this node 
will potentially have stale buffers in the buffer cache which will corrupt the 
filesystem if I try to modify it again.

I know I can get around this by forcing a BLKFLSBUF ioctl to the device after 
the unmount but this strikes me as a bug in the linux umount semantics which 
will bite more people than just me as linux enters the SAN arena.

I think the fix is simple (and I attach it below).

James Bottomley

------------ próxima parte ------------
Index: fs/super.c
===================================================================
RCS file: /home/jejb/CVSROOT/linux/2.2/fs/super.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 super.c
--- fs/super.c	2000/01/05 20:22:52	1.1.1.5
+++ fs/super.c	2000/01/25 01:40:48
@@ -716,6 +716,8 @@
 	unlock_super(sb);
 
 	remove_vfsmnt(dev);
+
+	invalidate_buffers(dev); /* flush the buffer cache */
 out:
 	return retval;
 }


Más información sobre la lista de distribución Ayuda