afs: Handle osi_NewVnode failures
[openafs.git] / src / afs / AIX / osi_vcache.c
index 5fb6e0c..351afbb 100644 (file)
 extern struct vnodeops *afs_ops;
 
 int
-osi_TryEvictVCache(struct vcache *avc, int *slept) {
-     if (!VREFCOUNT_GT(avc,0)
-         && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) {
-        code = afs_FlushVCache(avc, slept);
+osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep)
+{
+    int code;
+    if (!VREFCOUNT_GT(avc,0)
+       && avc->opens == 0 && (avc->f.states & CUnlinkedDel) == 0) {
+       code = afs_FlushVCache(avc, slept);
        if (code == 0)
            return 1;
-     }
-     return 0;
+    }
+    return 0;
 }
 
 struct vcache *
-osi_NewVnode(void) {
+osi_NewVnode(void)
+{
     struct vcache *tvc;
 
-    tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
+    tvc = afs_osi_Alloc(sizeof(struct vcache));
+    if (tvc == NULL) {
+       return NULL;
+    }
 
 #ifdef KERNEL_HAVE_PIN
     pin((char *)tvc, sizeof(struct vcache));   /* XXX */
@@ -40,7 +46,8 @@ osi_NewVnode(void) {
 }
 
 void
-osi_PrePopulateVCache(struct vcache *avc) {
+osi_PrePopulateVCache(struct vcache *avc)
+{
     memset(avc, 0, sizeof(struct vcache));
 
 #ifdef AFS_AIX32_ENV
@@ -55,10 +62,13 @@ osi_PrePopulateVCache(struct vcache *avc) {
 }
 
 void
-osi_AttachVnode(struct vcache *avc, int seq) { }
+osi_AttachVnode(struct vcache *avc, int seq)
+{
+}
 
 void
-osi_PostPopulateVCache(struct vcache *avc) {
+osi_PostPopulateVCache(struct vcache *avc)
+{
     avc->v.v_op = afs_ops;
 
     avc->v.v_vfsp = afs_globalVFS;
@@ -73,3 +83,9 @@ osi_PostPopulateVCache(struct vcache *avc) {
     avc->v.v_gnode->gn_vnode = &avc->v;
 }
 
+int
+osi_vnhold(struct vcache *avc)
+{
+    VN_HOLD(AFSTOV(avc));
+    return 0;
+}