From 63ba8d77fb139abdde915b5b44318edc9bc1bcbd Mon Sep 17 00:00:00 2001 From: Garry Zacheiss Date: Mon, 17 Nov 2003 23:21:52 +0000 Subject: [PATCH] callbacks-later-locking-order-20031117 be consistent in the order we hold H_LOCK and FSYNC_LOCK; in this case acquire FSYNC_LOCK as needed. --- src/viced/callback.c | 8 ++++---- src/viced/viced.c | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index 55af2b9eb..ef275898f 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1408,6 +1408,7 @@ BreakLaterCallBacks(void) /* Unchain first */ ViceLog(25, ("Looking for FileEntries to unchain\n")); H_LOCK; + FSYNC_LOCK; /* Pick the first volume we see to clean up */ fid.Volume = fid.Vnode = fid.Unique = 0; @@ -1430,14 +1431,14 @@ BreakLaterCallBacks(void) feip = &fe->fnext; } } + FSYNC_UNLOCK; if (!myfe) { - H_UNLOCK; + H_UNLOCK return 0; } /* loop over FEs from myfe and free/break */ - FSYNC_UNLOCK; tthead = 0; for (fe = myfe; fe;) { register struct CallBack *cbnext; @@ -1475,8 +1476,7 @@ BreakLaterCallBacks(void) henumParms.ncbas = 0; } } - FSYNC_LOCK; - H_UNLOCK;; + H_UNLOCK; /* Arrange to be called again */ return 1; diff --git a/src/viced/viced.c b/src/viced/viced.c index e9db54da8..f00d3e944 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -498,6 +498,7 @@ FsyncCheckLWP() if ((code = LWP_WaitProcess(fsync_wait)) != LWP_SUCCESS) ViceLog(0, ("LWP_WaitProcess returned %d\n", code)); #endif /* AFS_PTHREAD_ENV */ + FSYNC_UNLOCK; ViceLog(2, ("Checking for fsync events\n")); do { code = BreakLaterCallBacks(); -- 2.39.5