FBSD: avoid vrefl() 73/14373/3
authorBenjamin Kaduk <kaduk@mit.edu>
Fri, 25 Sep 2020 16:22:16 +0000 (09:22 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 2 Mar 2021 07:03:19 +0000 (02:03 -0500)
Commit 20dc2832268eb (correctly) introduced changes so that we
avoid interacting with vnodes marked as VI_DOOMED to the extent
possible, but in doing so inadvertendly used the vrefl() KPI that
was only introduced in FreeBSD 11.0.

Rewrite the relevant logic to use the older vref() KPI, at the cost
of a few more unlock/locks, in order to have a single codepath that
works on all supported FreeBSD versions.

Change-Id: Ib315d59ea6c6208bbd0c908d8eaf502a4de51869
Reviewed-on: https://gerrit.openafs.org/14373
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/FBSD/osi_vcache.c

index 22ca8d4..7c0e21b 100644 (file)
@@ -131,13 +131,14 @@ osi_vnhold(struct vcache *avc)
 {
     struct vnode *vp = AFSTOV(avc);
 
+    vref(vp);
     VI_LOCK(vp);
     if ((vp->v_iflag & VI_DOOMED) != 0) {
        VI_UNLOCK(vp);
+       vrele(vp);
        return ENOENT;
     }
 
-    vrefl(AFSTOV(avc));
     VI_UNLOCK(vp);
     return 0;
 }