From 73bfe94802ef62a7e6f8d2c36cb801be6ab2863a Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Fri, 18 May 2012 17:49:31 -0400 Subject: [PATCH] afs: Remove 'slept' from osi_VM_FlushVCache No implementation of osi_VM_FlushVCache drops and reacquires afs_xvcache. Doing so would cause problems when afs_FlushVCache calls osi_VM_FlushVCache, since someone could grab a reference to the vcache while xvcache is dropped. So, prohibit dropping and reacquiring afs_xvcache in osi_VM_FlushVCache, and remove the 'slept' argument to it. Change-Id: I50b4ee35f54a5277749f44e93b1094e4fb5c93e9 Reviewed-on: http://gerrit.openafs.org/7435 Reviewed-by: Alistair Ferguson Reviewed-by: Daria Brashear Reviewed-by: Benjamin Kaduk Tested-by: Benjamin Kaduk --- src/afs/AIX/osi_vm.c | 9 ++------- src/afs/DARWIN/osi_vm.c | 9 ++------- src/afs/FBSD/osi_vm.c | 11 +++-------- src/afs/HPUX/osi_vm.c | 9 ++------- src/afs/IRIX/osi_vm.c | 9 ++------- src/afs/LINUX/osi_prototypes.h | 2 +- src/afs/LINUX/osi_vm.c | 9 ++------- src/afs/LINUX24/osi_prototypes.h | 2 +- src/afs/LINUX24/osi_vm.c | 9 ++------- src/afs/NBSD/osi_vcache.c | 2 +- src/afs/NBSD/osi_vm.c | 13 ++++--------- src/afs/OBSD/osi_vm.c | 11 +++-------- src/afs/SOLARIS/osi_vm.c | 9 ++------- src/afs/UKERNEL/osi_vm.c | 2 +- src/afs/afs_prototypes.h | 2 +- src/afs/afs_vcache.c | 2 +- 16 files changed, 30 insertions(+), 80 deletions(-) diff --git a/src/afs/AIX/osi_vm.c b/src/afs/AIX/osi_vm.c index b7e233816..c2e11737d 100644 --- a/src/afs/AIX/osi_vm.c +++ b/src/afs/AIX/osi_vm.c @@ -22,15 +22,10 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { if (avc->vrefCount != 0) return EBUSY; diff --git a/src/afs/DARWIN/osi_vm.c b/src/afs/DARWIN/osi_vm.c index 805cb38f0..f84703752 100644 --- a/src/afs/DARWIN/osi_vm.c +++ b/src/afs/DARWIN/osi_vm.c @@ -23,17 +23,12 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. * * OSF/1 Locking: VN_LOCK has been called. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { struct vnode *vp = AFSTOV(avc); kern_return_t kret; diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index 40ba11904..d475d914e 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -10,7 +10,7 @@ /* osi_vm.c implements: * - * osi_VM_FlushVCache(avc, slept) + * osi_VM_FlushVCache(avc) * osi_ubc_flush_dirty_and_wait(vp, flags) * osi_VM_StoreAllSegments(avc) * osi_VM_TryToSmush(avc, acred, sync) @@ -75,16 +75,11 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. * */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { struct vnode *vp; int code; diff --git a/src/afs/HPUX/osi_vm.c b/src/afs/HPUX/osi_vm.c index 0e169bd0f..ef87e9108 100644 --- a/src/afs/HPUX/osi_vm.c +++ b/src/afs/HPUX/osi_vm.c @@ -22,15 +22,10 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { if (avc->vrefCount > 1) return EBUSY; diff --git a/src/afs/IRIX/osi_vm.c b/src/afs/IRIX/osi_vm.c index 50a61aeb7..7d07be076 100644 --- a/src/afs/IRIX/osi_vm.c +++ b/src/afs/IRIX/osi_vm.c @@ -25,15 +25,10 @@ extern struct vnodeops Afs_vnodeops; * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { int s, code; vnode_t *vp = &avc->v; diff --git a/src/afs/LINUX/osi_prototypes.h b/src/afs/LINUX/osi_prototypes.h index 316065f18..277b50a93 100644 --- a/src/afs/LINUX/osi_prototypes.h +++ b/src/afs/LINUX/osi_prototypes.h @@ -73,7 +73,7 @@ extern int osi_sysctl_init(void); extern void osi_sysctl_clean(void); /* osi_vm.c */ -extern int osi_VM_FlushVCache(struct vcache *avc, int *slept); +extern int osi_VM_FlushVCache(struct vcache *avc); extern void osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync); extern void osi_VM_FSyncInval(struct vcache *avc); diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c index 8bc792e45..d9e767d2d 100644 --- a/src/afs/LINUX/osi_vm.c +++ b/src/afs/LINUX/osi_vm.c @@ -33,15 +33,10 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { struct inode *ip = AFSTOV(avc); diff --git a/src/afs/LINUX24/osi_prototypes.h b/src/afs/LINUX24/osi_prototypes.h index ad2522cac..cb4bee153 100644 --- a/src/afs/LINUX24/osi_prototypes.h +++ b/src/afs/LINUX24/osi_prototypes.h @@ -70,7 +70,7 @@ extern int osi_sysctl_init(void); extern void osi_sysctl_clean(void); /* osi_vm.c */ -extern int osi_VM_FlushVCache(struct vcache *avc, int *slept); +extern int osi_VM_FlushVCache(struct vcache *avc); extern void osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync); extern void osi_VM_FSyncInval(struct vcache *avc); diff --git a/src/afs/LINUX24/osi_vm.c b/src/afs/LINUX24/osi_vm.c index 747e37b7d..ea65ff547 100644 --- a/src/afs/LINUX24/osi_vm.c +++ b/src/afs/LINUX24/osi_vm.c @@ -31,15 +31,10 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { struct inode *ip = AFSTOV(avc); diff --git a/src/afs/NBSD/osi_vcache.c b/src/afs/NBSD/osi_vcache.c index 8b37efa35..6ceefc9bc 100644 --- a/src/afs/NBSD/osi_vcache.c +++ b/src/afs/NBSD/osi_vcache.c @@ -24,7 +24,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) printf("%s enter\n", __func__); } - if (osi_VM_FlushVCache(avc, slept) != 0) { + if (osi_VM_FlushVCache(avc) != 0) { code = 0; } else { code = 1; diff --git a/src/afs/NBSD/osi_vm.c b/src/afs/NBSD/osi_vm.c index 5cc2beb3f..d3524294d 100644 --- a/src/afs/NBSD/osi_vm.c +++ b/src/afs/NBSD/osi_vm.c @@ -10,7 +10,7 @@ /* osi_vm.c implements: * - * osi_VM_FlushVCache(avc, slept) + * osi_VM_FlushVCache(avc) * osi_ubc_flush_dirty_and_wait(vp, flags) * osi_VM_StoreAllSegments(avc) * osi_VM_TryToSmush(avc, acred, sync) @@ -32,17 +32,12 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. * * OSF/1 Locking: VN_LOCK has been called. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { struct vnode *vp = AFSTOV(avc); @@ -110,7 +105,7 @@ osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync) } ReleaseWriteLock(&avc->lock); - osi_VM_FlushVCache(avc, NULL); + osi_VM_FlushVCache(avc); ObtainWriteLock(&avc->lock, 59); if ((afs_debug & AFSDEB_VNLAYER) != 0) { diff --git a/src/afs/OBSD/osi_vm.c b/src/afs/OBSD/osi_vm.c index 737b74231..419516121 100644 --- a/src/afs/OBSD/osi_vm.c +++ b/src/afs/OBSD/osi_vm.c @@ -10,7 +10,7 @@ /* osi_vm.c implements: * - * osi_VM_FlushVCache(avc, slept) + * osi_VM_FlushVCache(avc) * osi_ubc_flush_dirty_and_wait(vp, flags) * osi_VM_StoreAllSegments(avc) * osi_VM_TryToSmush(avc, acred, sync) @@ -36,17 +36,12 @@ * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. * * OSF/1 Locking: VN_LOCK has been called. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { struct vnode *vp = AFSTOV(avc); diff --git a/src/afs/SOLARIS/osi_vm.c b/src/afs/SOLARIS/osi_vm.c index 10fbb3330..99f1439c2 100644 --- a/src/afs/SOLARIS/osi_vm.c +++ b/src/afs/SOLARIS/osi_vm.c @@ -89,15 +89,10 @@ osi_VM_MultiPageConflict(struct vcache *avc, struct dcache *adc) * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * - * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, - * *slept should be set to warn the caller. - * - * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it - * is not dropped and re-acquired for any platform. It may be that *slept is - * therefore obsolescent. + * Locking: afs_xvcache lock is held. It must not be dropped. */ int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { if (avc->vrefCount != 0) return EBUSY; diff --git a/src/afs/UKERNEL/osi_vm.c b/src/afs/UKERNEL/osi_vm.c index a0e7fd677..3585ce3b7 100644 --- a/src/afs/UKERNEL/osi_vm.c +++ b/src/afs/UKERNEL/osi_vm.c @@ -22,7 +22,7 @@ osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred) } int -osi_VM_FlushVCache(struct vcache *avc, int *slept) +osi_VM_FlushVCache(struct vcache *avc) { return 0; } diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index a2853db0f..0ad3e6959 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -747,7 +747,7 @@ extern afs_int32 osi_get_group_pag(afs_ucred_t *cred); /* ARCH/osi_vm.c */ -extern int osi_VM_FlushVCache(struct vcache *avc, int *slept); +extern int osi_VM_FlushVCache(struct vcache *avc); extern void osi_VM_StoreAllSegments(struct vcache *avc); extern void osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync); diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 72b511c4f..dad73bbfe 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -143,7 +143,7 @@ afs_FlushVCache(struct vcache *avc, int *slept) afs_Trace2(afs_iclSetp, CM_TRACE_FLUSHV, ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, avc->f.states); - code = osi_VM_FlushVCache(avc, slept); + code = osi_VM_FlushVCache(avc); if (code) goto bad; -- 2.39.5