From 03a54723eaf23b2aad0d026ba5f1a8e7343b3763 Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Fri, 17 Jun 2011 02:22:34 -0400 Subject: [PATCH] FBSD: do not FlushAllVCaches In normal operation, any AFS vcache with associated data will have an associated vnode, which will be on the list of vnodes associated with the /afs mountpoint. We already call FreeBSD's vflush() in our afs_unmount, which walks the list of vnodes associated with the mountpoint and calls vgonel() on them, which calls VOP_CLOSE and VOP_RECLAIM on the vnode. Our implementation of VOP_RECLAIM already calls FlushVCache, so in normal operation, FlushAllVCaches() will be a no-op. However, in the presence of bugs, it is actively harmful, causing panics. For example, if a vnode has been reclaimed but FlushVCache failed (which we cannot report back since the VFS will panic in this case), and we attempt to flush it again, the associated vnode has already been cleaned up and we will panic. Likewise if our list of vcaches becomes corrupt and has a vcache with bad or missing vnode for some other reason, we will panic. Since there is no gain in normal operation and abnormal operation is more likely to panic than save data, skip the extra flush. Change-Id: Id227ca74f4036c1c1f40a41a922e73198f16f958 Reviewed-on: http://gerrit.openafs.org/4847 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/afs_call.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 8d972dd..97f518f 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1380,7 +1380,12 @@ afs_shutdown(void) afs_warn("afs: WARM "); afs_warn("shutting down of: vcaches... "); +#if !defined(AFS_FBSD_ENV) + /* The FBSD afs_unmount() calls vflush(), which reclaims all vnodes + * on the mountpoint, flushing them in the process. In the presence + * of bugs, flushing again here can cause panics. */ afs_FlushAllVCaches(); +#endif afs_warn("CB... "); -- 1.9.4