SOLARIS: Use vn_renamepath when available
authorAndrew Deason <adeason@sinenomine.net>
Tue, 8 Jan 2013 23:41:21 +0000 (17:41 -0600)
committerDerrick Brashear <shadow@your-file-system.com>
Wed, 9 Jan 2013 15:07:35 +0000 (07:07 -0800)
In Solaris 11.1, the signature of vn_setpath changes; it gains an
extra boolean_t argument called 'force'. Instead of trying to adapt to
it, call vn_renamepath() instead, which will do the correct thing and
call vn_setpath &co for us. vn_renamepath has existed since Solaris 10
Update 8, and is in all releases of Solaris 11. Only call it in
Solaris 11, since it makes the ifdefs easier, and there are no
problems with calling vn_setpath on Solaris 10.

Thanks to Frank Batschulat for all of the relevant information.

Change-Id: Iad4ada70abbb5ec2289c30149ab4c571fa8a68ff
Reviewed-on: http://gerrit.openafs.org/8894
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/afs/SOLARIS/osi_vnodeops.c

index b0076ec..068a4b3 100644 (file)
@@ -1557,7 +1557,10 @@ gafs_rename(struct vcache *aodp, char *aname1,
        (void) afs_lookup(andp, aname2, &avcp, NULL, 0, NULL, acred);
        if (avcp) {
            struct vnode *vp = AFSTOV(avcp), *pvp = AFSTOV(andp);
-           
+
+# ifdef AFS_SUN511_ENV
+           vn_renamepath(pvp, vp, aname2, strlen(aname2));
+# else
            mutex_enter(&vp->v_lock);
            if (vp->v_path != NULL) {
                kmem_free(vp->v_path, strlen(vp->v_path) + 1);
@@ -1565,6 +1568,7 @@ gafs_rename(struct vcache *aodp, char *aname1,
            }
            mutex_exit(&vp->v_lock);
            vn_setpath(afs_globalVp, pvp, vp, aname2, strlen(aname2));
+# endif /* !AFS_SUN511_ENV */
 
            AFS_RELE(avcp);
        }