src/host_id.c | 10 +++++++++-
src/sanlock_admin.h | 21 +++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
New commits:
commit eea3d846da525da77e2cf19ff2a409f913a0ca70
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jun 23 17:19:36 2011 -0500
sanlock: return -EINPROGRESS from add_lockspace
if the lockspace is already in the process of being added.
We previously returned -EEXIST in this case.
The in-progress add operation may or may not succeed.
diff --git a/src/host_id.c b/src/host_id.c
index 9cb8617..b2c64c2 100644
--- a/src/host_id.c
+++ b/src/host_id.c
@@ -370,7 +370,7 @@ int add_lockspace(struct sanlk_lockspace *ls)
/* search all lists for an identical lockspace */
sp2 = _search_space(sp->space_name, &sp->host_id_disk, sp->host_id,
- &spaces, &spaces_add, NULL);
+ &spaces, NULL, NULL);
if (sp2) {
pthread_mutex_unlock(&spaces_mutex);
rv = -EEXIST;
@@ -378,6 +378,14 @@ int add_lockspace(struct sanlk_lockspace *ls)
}
sp2 = _search_space(sp->space_name, &sp->host_id_disk, sp->host_id,
+ &spaces_add, NULL, NULL);
+ if (sp2) {
+ pthread_mutex_unlock(&spaces_mutex);
+ rv = -EINPROGRESS;
+ goto fail_free;
+ }
+
+ sp2 = _search_space(sp->space_name, &sp->host_id_disk, sp->host_id,
&spaces_rem, NULL, NULL);
if (sp2) {
pthread_mutex_unlock(&spaces_mutex);
diff --git a/src/sanlock_admin.h b/src/sanlock_admin.h
index cabc24c..a210bc4 100644
--- a/src/sanlock_admin.h
+++ b/src/sanlock_admin.h
@@ -16,7 +16,28 @@
int sanlock_status(int debug);
int sanlock_log_dump(void);
int sanlock_shutdown(void);
+
+/*
+ * add_lockspace returns:
+ * 0: the lockspace has been added successfully
+ * -EEXIST: the lockspace already exists
+ * -EINPROGRESS: the lockspace is already in the process of being added
+ * (the in-progress add may or may not succeed)
+ * -EAGAIN: the lockspace is being removed
+ */
+
int sanlock_add_lockspace(struct sanlk_lockspace *ls, uint32_t flags);
+
+/*
+ * rem_lockspace returns:
+ * 0: the lockspace has been removed successfully
+ * -EINPROGRESS: the lockspace is already in the process of being removed
+ * -ENOENT: lockspace not found
+ *
+ * The sanlock daemon will kill any pids using the lockspace when the
+ * lockspace is removed.
+ */
+
int sanlock_rem_lockspace(struct sanlk_lockspace *ls, uint32_t flags);
#endif
Show replies by date