From e8d033f2c72e27c83df510d32ec6b471f650206c Mon Sep 17 00:00:00 2001 From: ghelmer Date: Mon, 5 May 2014 16:52:38 +0000 Subject: [PATCH] MFC r264617: Fix releasing the lock in the parent atrun process after the queue directory has been processed. Otherwise, a long-running child process caused other atrun invocations to stall unnecessarily. Submitted by: J.R. Oldroyd jr at opal.com git-svn-id: svn://svn.freebsd.org/base/stable/10@265368 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- libexec/atrun/atrun.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c index 594107e3d..1e25766c4 100644 --- a/libexec/atrun/atrun.c +++ b/libexec/atrun/atrun.c @@ -567,6 +567,12 @@ main(int argc, char *argv[]) if (run_batch && (gloadavg() < load_avg)) run_file(batch_name, batch_uid, batch_gid); + if (flock(dirfd(spool), LOCK_UN) == -1) + perr("cannot unlock %s", ATJOB_DIR); + + if (closedir(spool) == -1) + perr("cannot closedir %s", ATJOB_DIR); + closelog(); exit(EXIT_SUCCESS); } -- 2.42.0