From: Derrick Brashear Date: Mon, 26 Apr 2010 21:43:16 +0000 (-0400) Subject: flush changes on LOCK_EX unlock X-Git-Tag: openafs-devel-1_5_75~355 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=014821d281cac7815ac7908a853191b17bf2a868;p=packages%2Fo%2Fopenafs.git flush changes on LOCK_EX unlock right now, flock with LOCK_EX, on unlock, triggers an async store. make it sync, but also, make sure to ask to have any in-memory data sent to us (e.g. VM_StoreAllSegments); unlike Solaris VMSYNC_INVAL, we don't want to invalidate the pages, just get copies written back. LOCK_SH did not, does not and AFAICT should not trigger writes. Change-Id: Id4a72f73b685b5566bb31f6f610f22d806899280 Reviewed-on: http://gerrit.openafs.org/1846 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/VNOPS/afs_vnop_flock.c b/src/afs/VNOPS/afs_vnop_flock.c index 1f330440c..d8b159d82 100644 --- a/src/afs/VNOPS/afs_vnop_flock.c +++ b/src/afs/VNOPS/afs_vnop_flock.c @@ -317,7 +317,7 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq, } } } else if (avc->flockCount == -1) { - afs_StoreAllSegments(avc, areq, AFS_ASYNC); /* fsync file early */ + afs_StoreAllSegments(avc, areq, AFS_SYNC | AFS_VMSYNC); /* fsync file early */ avc->flockCount = 0; /* And remove the (only) exclusive lock entry from the list... */ osi_FreeSmallSpace(avc->slocks); diff --git a/src/afs/afs.h b/src/afs/afs.h index a16a5a499..8aaab81a4 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -118,7 +118,7 @@ struct sysname_info { #define AFS_SYNC 1 #define AFS_VMSYNC_INVAL 2 /* sync and invalidate pages */ #define AFS_LASTSTORE 4 - +#define AFS_VMSYNC 8 /* sync pages but do not invalidate */ /* background request structure */ #define BPARMS 4 diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index db1805578..325ae626b 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -186,7 +186,9 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, * on the memcache case since that's we adjust the file's size * and finish flushing partial vm pages. */ - if ((cacheDiskType != AFS_FCACHE_TYPE_MEM) || (sync & AFS_LASTSTORE)) + if ((cacheDiskType != AFS_FCACHE_TYPE_MEM) || + (sync & AFS_VMSYNC_INVAL) || (sync & AFS_VMSYNC) || + (sync & AFS_LASTSTORE)) #endif /* !AFS_AIX32_ENV && !AFS_SGI65_ENV */ { /* If we're not diskless, reading a file may stress the VM