diff options
author | Jonathan Earl Brassow <jbrassow@redhat.com> | 2011-02-04 20:30:17 +0000 |
---|---|---|
committer | Jonathan Earl Brassow <jbrassow@redhat.com> | 2011-02-04 20:30:17 +0000 |
commit | 27ff8813da360da17c974f47e6e376fefddfd2f5 (patch) | |
tree | 5ca4fe5bcd77a54a2caa1be6f78fbd734bdf2b1c /daemons | |
parent | 880507498a16603b9bf874d60433f88ab6d7d0b8 (diff) | |
download | lvm2-27ff8813da360da17c974f47e6e376fefddfd2f5.tar.gz lvm2-27ff8813da360da17c974f47e6e376fefddfd2f5.tar.xz lvm2-27ff8813da360da17c974f47e6e376fefddfd2f5.zip |
Allow snapshots in a cluster as long as they are exclusively
activated.
In order to achieve this, we need to be able to query whether
the origin is active exclusively (a condition of being able to
add an exclusive snapshot).
Once we are able to query the exclusive activation of an LV, we
can safely create/activate the snapshot.
A change to 'hold_lock' was also made so that a request to aquire
a WRITE lock did not replace an EX lock, which is already a form
of write lock.
Diffstat (limited to 'daemons')
-rw-r--r-- | daemons/clvmd/lvm-functions.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index 1fa23483..81e8b884 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -240,9 +240,17 @@ static int hold_lock(char *resource, int mode, int flags) lvi = lookup_info(resource); - if (lvi && lvi->lock_mode == mode) { - DEBUGLOG("hold_lock, lock mode %d already held\n", mode); - return 0; + if (lvi) { + if (lvi->lock_mode == mode) { + DEBUGLOG("hold_lock, lock mode %d already held\n", + mode); + return 0; + } + if ((lvi->lock_mode == LCK_EXCL) && (mode == LCK_WRITE)) { + DEBUGLOG("hold_lock, lock already held LCK_EXCL, " + "ignoring LCK_WRITE request"); + return 0; + } } /* Only allow explicit conversions */ |