aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/user.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-10-17 12:05:50 -0400
committerDavid Teigland <teigland@redhat.com>2014-11-19 15:48:02 -0500
commit2ab4bd8ea3a6954bc79a9bbeb291cd6c2d6213a7 (patch)
treec15e4590760ba76c29f2fca34c1b1edf82186cbd /fs/dlm/user.c
parent206c5f60a3d902bc4b56dab2de3e88de5eb06108 (diff)
dlm: adopt orphan locks
A process may exit, leaving an orphan lock in the lockspace. This adds the capability for another process to acquire the orphan lock. Acquiring the orphan just moves the lock from the orphan list onto the acquiring process's list of locks. An adopting process must specify the resource name and mode of the lock it wants to adopt. If a matching lock is found, the lock is moved to the caller's 's list of locks, and the lkid of the lock is returned like the lkid of a new lock. If an orphan with a different mode is found, then -EAGAIN is returned. If no orphan lock is found on the resource, then -ENOENT is returned. No async completion is used because the result is immediately available. Also, when orphans are purged, allow a zero nodeid to refer to the local nodeid so the caller does not need to look up the local nodeid. Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/user.c')
-rw-r--r--fs/dlm/user.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 142e21655eed..fb85f32e9eca 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -238,6 +238,7 @@ static int device_user_lock(struct dlm_user_proc *proc,
238{ 238{
239 struct dlm_ls *ls; 239 struct dlm_ls *ls;
240 struct dlm_user_args *ua; 240 struct dlm_user_args *ua;
241 uint32_t lkid;
241 int error = -ENOMEM; 242 int error = -ENOMEM;
242 243
243 ls = dlm_find_lockspace_local(proc->lockspace); 244 ls = dlm_find_lockspace_local(proc->lockspace);
@@ -260,12 +261,20 @@ static int device_user_lock(struct dlm_user_proc *proc,
260 ua->bastaddr = params->bastaddr; 261 ua->bastaddr = params->bastaddr;
261 ua->xid = params->xid; 262 ua->xid = params->xid;
262 263
263 if (params->flags & DLM_LKF_CONVERT) 264 if (params->flags & DLM_LKF_CONVERT) {
264 error = dlm_user_convert(ls, ua, 265 error = dlm_user_convert(ls, ua,
265 params->mode, params->flags, 266 params->mode, params->flags,
266 params->lkid, params->lvb, 267 params->lkid, params->lvb,
267 (unsigned long) params->timeout); 268 (unsigned long) params->timeout);
268 else { 269 } else if (params->flags & DLM_LKF_ORPHAN) {
270 error = dlm_user_adopt_orphan(ls, ua,
271 params->mode, params->flags,
272 params->name, params->namelen,
273 (unsigned long) params->timeout,
274 &lkid);
275 if (!error)
276 error = lkid;
277 } else {
269 error = dlm_user_request(ls, ua, 278 error = dlm_user_request(ls, ua,
270 params->mode, params->flags, 279 params->mode, params->flags,
271 params->name, params->namelen, 280 params->name, params->namelen,