Module Name: src Committed By: manu Date: Sat Jul 21 05:17:11 UTC 2012
Modified Files: src/lib/libpuffs: dispatcher.c puffs.h src/sys/fs/puffs: puffs_msgif.c puffs_msgif.h puffs_sys.h puffs_vfsops.c puffs_vnops.c Log Message: - Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes. The normal kernel behavior is to retain inactive nodes in the freelist until it runs out of vnodes. This has some merit for local filesystems, where the cost of an allocation is about the same as the cost of a lookup. But that situation is not true for distributed filesystems. On the other hand, keeping inactive nodes for a long time hold memory in the file server process, and when the kernel runs out of vnodes, it produce reclaim avalanches that increase lattency for other operations. We do not reclaim inactive vnodes immediatly either, as they may be looked up again shortly. Instead we introduce a grace time and we reclaim nodes that have been inactive beyond the grace time. - Fix lookup/reclaim race condition. The above improvement undercovered a race condition between lookup and reclaim. If we reclaimed a vnode associated with a userland cookie while a lookup returning that same cookiewas inprogress, then the kernel ends up with a vnode associated with a cookie that has been reclaimed in userland. Next operation on the cookie will crash (or at least confuse) the filesystem. We fix this by introducing a lookup count in kernel and userland. On reclaim, the kernel sends the count, which enable userland to detect situation where it initiated a lookup that is not completed in kernel. In such a situation, the reclaim must be ignored, as the node is about to be looked up again. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/lib/libpuffs/dispatcher.c cvs rdiff -u -r1.122 -r1.123 src/lib/libpuffs/puffs.h cvs rdiff -u -r1.89 -r1.90 src/sys/fs/puffs/puffs_msgif.c cvs rdiff -u -r1.78 -r1.79 src/sys/fs/puffs/puffs_msgif.h cvs rdiff -u -r1.79 -r1.80 src/sys/fs/puffs/puffs_sys.h cvs rdiff -u -r1.101 -r1.102 src/sys/fs/puffs/puffs_vfsops.c cvs rdiff -u -r1.166 -r1.167 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.