From d61cb9ad764115811fcca3dd0a735ecad1d6eac4 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 1 Dec 2014 10:11:38 -0600 Subject: [PATCH] LINUX: Remove fix_bad_parent For Linux, fix_bad_parent (and in 1.6 and earlier, check_bad_parent) served the purpose of fixing mvid if it was "wrong", for volume-root vcaches (mvstat == 2). However, in modern Linux, we never really use mvid for root vcaches. This would normally be used for looking up ".." entries in the root dir, but Linux handles that for us. Specifically, the only times an "mvstat == 2" mvid is used are: - afs_lookup(), where we specifically check for a ".." lookup. Linux cannot give us a lookup for "..", since Linux itself services ".." lookups through the dcache. - afs_readdir_move(), where we look for ".." entries. Linux does not use this function, since Linux reimplements afs_readdir() in afs_linux_readdir(), and so this function is never called. Of course, mvid is used in many other locations, mostly for "mvstat == 1" vcaches (mountpoints) and a few other special cases. But these are the instances where mvid is relevant for root dirs. So, since mvid is never really used for "mvstat == 2" vcaches on Linux, don't bother trying to keep it up-to-date. Doing so is just needless waste, and causes problems when there are bugs in fix_bad_parent. The mvid field is still updated in cross-platform code from time to time; removing that would be more complex and possibly not worth the effort. Change-Id: I5011ba069e5c8ed947ab6ff8d8dd393241d9c4bf Reviewed-on: http://gerrit.openafs.org/11615 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Daria Brashear --- src/afs/LINUX/osi_vnodeops.c | 64 +----------------------------------- 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index b2ab9d53e..fbaa41053 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -932,44 +932,6 @@ canonical_dentry(struct inode *ip) * AFS Linux dentry operations **********************************************************************/ -/* fix_bad_parent() : called if this dentry's vcache is a root vcache - * that has its mvid (parent dir's fid) pointer set to the wrong directory - * due to being mounted in multiple points at once. fix_bad_parent() - * calls afs_lookup() to correct the vcache's mvid, as well as the volume's - * dotdotfid and mtpoint fid members. - * Parameters: - * dp - dentry to be checked. - * credp - credentials - * vcp, pvc - item's and parent's vcache pointer - * Return Values: - * None. - * Sideeffects: - * This dentry's vcache's mvid will be set to the correct parent directory's - * fid. - * This root vnode's volume will have its dotdotfid and mtpoint fids set - * to the correct parent and mountpoint fids. - */ - -static inline void -fix_bad_parent(struct dentry *dp, cred_t *credp, struct vcache *vcp, struct vcache *pvc) -{ - struct vcache *avc = NULL; - int code; - - /* force a lookup, so vcp->mvid is fixed up */ - code = afs_lookup(pvc, (char *)dp->d_name.name, &avc, credp); - if (code || vcp != avc) { /* bad, very bad.. */ - afs_Trace4(afs_iclSetp, CM_TRACE_TMP_1S3L, ICL_TYPE_STRING, - "check_bad_parent: bad pointer returned from afs_lookup origvc newvc dentry", - ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, avc, - ICL_TYPE_POINTER, dp); - } - if (avc) - AFS_RELE(AFSTOV(avc)); - - return; -} - /* afs_linux_revalidate * Ensure vcache is stat'd before use. Return 0 if entry is valid. */ @@ -991,25 +953,6 @@ afs_linux_revalidate(struct dentry *dp) goto out; } -#ifdef notyet - /* Make this a fast path (no crref), since it's called so often. */ - if (vcp->states & CStatd) { - struct vcache *pvc = VTOAFS(dp->d_parent->d_inode); - - if (*dp->d_name.name != '/' && vcp->mvstat == 2) { /* root vnode */ - if (vcp->mvid->Fid.Volume != pvc->fid.Fid.Volume) { /* bad parent */ - credp = crref(); - AFS_GLOCK(); - fix_bad_parent(dp); /* check and correct mvid */ - AFS_GUNLOCK(); - crfree(credp); - } - } - afs_DestroyAttr(vattr); - return 0; - } -#endif - /* This avoids the crref when we don't have to do it. Watch for * changes in afs_getattr that don't get replicated here! */ @@ -1253,12 +1196,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) goto bad_dentry; } } - } else - if (locked && *dp->d_name.name != '/' && vcp->mvstat == 2) { /* root vnode */ - if (vcp->mvid->Fid.Volume != pvcp->f.fid.Fid.Volume) { /* bad parent */ - fix_bad_parent(dp, credp, vcp, pvcp); /* check and correct mvid */ - } - } + } #ifdef notdef /* If the last looker changes, we should make sure the current -- 2.39.5