From: Chas Williams Date: Wed, 7 Sep 2005 18:43:25 +0000 (+0000) Subject: STABLE14-linux-root-fix-reval-20050907 X-Git-Tag: openafs-stable-1_4_0-rc4~10 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=be72ae9a8ac0d2b9bfe3c703281141d92fb96de0;p=packages%2Fo%2Fopenafs.git STABLE14-linux-root-fix-reval-20050907 FIXES 21390 revalidate the root vnode correctly so if we become replicated we don't lose (cherry picked from commit 6d6789345ecab70c973cea46b5b262e92e153498) --- diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index dcb3d46cd..fc1ad7329 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -310,7 +310,50 @@ afs_CheckRootVolume(void) * directory is /afs. */ #ifdef AFS_LINUX20_ENV - printk("afs_CheckVolume(): afs_root changed.\n"); + { + struct vrequest treq; + struct vattr vattr; + cred_t *credp; + struct dentry *dp; + struct vcache *vcp; + + afs_rootFid.Fid.Volume = volid; + afs_rootFid.Fid.Vnode = 1; + afs_rootFid.Fid.Unique = 1; + + credp = crref(); + if (afs_InitReq(&treq, credp)) + goto out; + vcp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL); + if (!vcp) + goto out; + afs_getattr(vcp, &vattr, credp); + afs_fill_inode(AFSTOV(vcp), &vattr); + + dp = d_find_alias(AFSTOV(afs_globalVp)); + +#if defined(AFS_LINUX24_ENV) + spin_lock(&dcache_lock); +#if defined(AFS_LINUX26_ENV) + spin_lock(&dp->d_lock); +#endif +#endif + list_del_init(&dp->d_alias); + list_add(&dp->d_alias, &(AFSTOV(vcp)->i_dentry)); + dp->d_inode = AFSTOV(vcp); +#if defined(AFS_LINUX24_ENV) +#if defined(AFS_LINUX26_ENV) + spin_unlock(&dp->d_lock); +#endif + spin_unlock(&dcache_lock); +#endif + dput(dp); + + AFS_FAST_RELE(afs_globalVp); + afs_globalVp = vcp; + out: + crfree(credp); + } #else AFS_FAST_RELE(afs_globalVp); afs_globalVp = 0;