diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-05-17 11:04:53 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-05-17 11:04:53 -0700 |
commit | e9a2127e7fc20673e3aa1b09d54743077947c70e (patch) | |
tree | 1df056ff8f61cc7a81b9a42f2395828905e38a63 /src/commit | |
parent | 9d5b213893a79939ac8f2e871e18ba3163eeab50 (diff) | |
download | vyatta-cfg-e9a2127e7fc20673e3aa1b09d54743077947c70e.tar.gz vyatta-cfg-e9a2127e7fc20673e3aa1b09d54743077947c70e.zip |
reimplement commit locking
Diffstat (limited to 'src/commit')
-rw-r--r-- | src/commit/commit-algorithm.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/commit/commit-algorithm.cpp b/src/commit/commit-algorithm.cpp index a5d3415..46cfa58 100644 --- a/src/commit/commit-algorithm.cpp +++ b/src/commit/commit-algorithm.cpp @@ -1157,6 +1157,18 @@ commit::isCommitPathEffective(Cstore& cs, const Cpath& pcomps, bool commit::doCommit(Cstore& cs, CfgNode& cfg1, CfgNode& cfg2) { + /* get the lock first. + * note: the getCommitLock() interface provided by Cstore guarantees + * that the lock will be released upon process termination (either + * normally or abnormally), so this is all that is required in terms + * of commit locking. + */ + if (!cs.getCommitLock()) { + OUTPUT_USER("Configuration system temporarily locked " + "due to another commit in progress\n"); + return false; + } + Cpath p; CfgNode *root = getCommitTree(&cfg1, &cfg2, p); if (!root) { |