Module Name: src Committed By: manu Date: Mon Aug 29 04:12:46 UTC 2011
Modified Files: src/sys/fs/puffs: puffs_node.c puffs_sys.h puffs_vnops.c Log Message: Add a mutex for operations that touch size (setattr, getattr, write, fsync). This is required to avoid data corruption bugs, where a getattr slices itself within a setattr operation, and sets the size to the stall value it got from the filesystem. That value is smaller than the one set by setattr, and the call to uvm_vnp_setsize() trigged a spurious truncate. The result is a chunk of zeroed data in the file. Such a situation can easily happen when the ioflush thread issue a VOP_FSYNC/puffs_vnop_sync/flushvncache/dosetattrn while andother process do a sys_stat/VOP_GETATTR/puffs_vnop_getattr. This mutex on size operation can be removed the day we decide VOP_GETATTR has to operated on a locked vnode, since the other operations that touch size already require that. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/fs/puffs/puffs_node.c cvs rdiff -u -r1.77 -r1.78 src/sys/fs/puffs/puffs_sys.h cvs rdiff -u -r1.154 -r1.155 src/sys/fs/puffs/puffs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.