[OpenAFS-devel] patch: handle ATTR_HINT flag for Solaris

Nickolai Zeldovich kolya@MIT.EDU
Tue, 05 Dec 2000 18:35:33 -0500


This patch makes the afs_getattr() function return the current
attributes in the vnode if the ATTR_HINT flag is passed (Solaris
only), rather than making sure it's exactly correct by fetching
the status over the network.

Currently, if a user-space process reads /proc/NNN/status, the
kernel ends up calling rm_assize() to find the size of that proc's
address space, which calls getattr with ATTR_HINT. Blocking here
in RX network wait, especially if the calling user doesn't have
tokens to do FetchStatus on the relevant files, is bad.

-- kolya

Index: VNOPS/afs_vnop_attrs.c
===================================================================
RCS file: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v
retrieving revision 1.2
diff -c -r1.2 afs_vnop_attrs.c
*** VNOPS/afs_vnop_attrs.c	2000/11/04 10:03:30	1.2
--- VNOPS/afs_vnop_attrs.c	2000/12/05 23:27:29
***************
*** 188,193 ****
--- 188,200 ----
      afs_Trace2(afs_iclSetp, CM_TRACE_GETATTR, ICL_TYPE_POINTER, avc, 
  	       ICL_TYPE_INT32, avc->m.Length);
  
+ #if defined(AFS_SUN5_ENV)
+     if (flags & ATTR_HINT) {
+ 	code = afs_CopyOutAttrs(avc, attrs);
+ 	return code;
+     }
+ #endif
+ 
  #if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
      afs_BozonLock(&avc->pvnLock, avc);
  #endif