This repository has been archived by the owner on Aug 29, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 974268 - Narrow the window where user and quota data can get out …
…of sync and set the start time prior to any other collection. Deal with a race condition with the lock files in unix_user.
- Loading branch information
Showing
4 changed files
with
59 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Cleanup stale uuid lock files from the unix_user module | ||
# | ||
# | ||
# There is an extremely narrow but unavoidable race condition where | ||
# this script could break the synchronization between two instances of | ||
# unix_user.rb waiting for the same lock. | ||
# | ||
|
||
# Find lock files from unix_user.rb that are over a week old. The | ||
# number of files could be well beyond the command line length limit. | ||
find /var/lock -mindepth 1 -maxdepth 1 -type f -mtime +7 \ | ||
\( -name 'oo-create.*' -o -name 'oo-modify-ssh-keys.*' \) 2>/dev/null | { | ||
while read lockfile | ||
do | ||
( | ||
flock 200 | ||
rm -f "$lockfile" | ||
flock -u 200 | ||
) 200>"$lockfile" | ||
done | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters