afs: Remove 'slept' from osi_VM_FlushVCache
authorAndrew Deason <adeason@sinenomine.net>
Fri, 18 May 2012 21:49:31 +0000 (17:49 -0400)
committerDaria Brashear <shadow@your-file-system.com>
Fri, 12 Dec 2014 21:58:05 +0000 (16:58 -0500)
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 <alistair.ferguson@mac.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

16 files changed:
src/afs/AIX/osi_vm.c
src/afs/DARWIN/osi_vm.c
src/afs/FBSD/osi_vm.c
src/afs/HPUX/osi_vm.c
src/afs/IRIX/osi_vm.c
src/afs/LINUX/osi_prototypes.h
src/afs/LINUX/osi_vm.c
src/afs/LINUX24/osi_prototypes.h
src/afs/LINUX24/osi_vm.c
src/afs/NBSD/osi_vcache.c
src/afs/NBSD/osi_vm.c
src/afs/OBSD/osi_vm.c
src/afs/SOLARIS/osi_vm.c
src/afs/UKERNEL/osi_vm.c
src/afs/afs_prototypes.h
src/afs/afs_vcache.c

index b7e2338..c2e1173 100644 (file)
  * 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;
index 805cb38..f847037 100644 (file)
  * 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;
index 40ba119..d475d91 100644 (file)
@@ -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)
  * 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;
index 0e169bd..ef87e91 100644 (file)
  * 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;
index 50a61ae..7d07be0 100644 (file)
@@ -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;
index 316065f..277b50a 100644 (file)
@@ -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);
index 8bc792e..d9e767d 100644 (file)
  * 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);
 
index ad2522c..cb4bee1 100644 (file)
@@ -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);
index 747e37b..ea65ff5 100644 (file)
  * 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);
 
index 8b37efa..6ceefc9 100644 (file)
@@ -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;
index 5cc2beb..d352429 100644 (file)
@@ -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)
  * 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) {
index 737b742..4195161 100644 (file)
@@ -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)
  * 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);
 
index 10fbb33..99f1439 100644 (file)
@@ -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;
index a0e7fd6..3585ce3 100644 (file)
@@ -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;
 }
index a2853db..0ad3e69 100644 (file)
@@ -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);
index 72b511c..dad73bb 100644 (file)
@@ -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;