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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Derrick Brashear 2010-04-26 17:43:16 -04:00
parent fa70575af3
commit 014821d281
3 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

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

View File

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