Commit 8c55f146 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dlm-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm

Pull dlm update from David Teigland:
 "This includes a single patch to avoid fully processing a posix unlock
  from close when no posix locks exist on the file"

* tag 'dlm-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
  dlm: avoid unnecessary posix unlock
parents 8728f986 90008318
...@@ -247,6 +247,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, ...@@ -247,6 +247,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct dlm_ls *ls; struct dlm_ls *ls;
struct plock_op *op; struct plock_op *op;
int rv; int rv;
unsigned char fl_flags = fl->fl_flags;
ls = dlm_find_lockspace_local(lockspace); ls = dlm_find_lockspace_local(lockspace);
if (!ls) if (!ls)
...@@ -258,9 +259,18 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, ...@@ -258,9 +259,18 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
goto out; goto out;
} }
if (posix_lock_file_wait(file, fl) < 0) /* cause the vfs unlock to return ENOENT if lock is not found */
log_error(ls, "dlm_posix_unlock: vfs unlock error %llx", fl->fl_flags |= FL_EXISTS;
(unsigned long long)number);
rv = posix_lock_file_wait(file, fl);
if (rv == -ENOENT) {
rv = 0;
goto out_free;
}
if (rv < 0) {
log_error(ls, "dlm_posix_unlock: vfs unlock error %d %llx",
rv, (unsigned long long)number);
}
op->info.optype = DLM_PLOCK_OP_UNLOCK; op->info.optype = DLM_PLOCK_OP_UNLOCK;
op->info.pid = fl->fl_pid; op->info.pid = fl->fl_pid;
...@@ -296,9 +306,11 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, ...@@ -296,9 +306,11 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
if (rv == -ENOENT) if (rv == -ENOENT)
rv = 0; rv = 0;
out_free:
kfree(op); kfree(op);
out: out:
dlm_put_lockspace(ls); dlm_put_lockspace(ls);
fl->fl_flags = fl_flags;
return rv; return rv;
} }
EXPORT_SYMBOL_GPL(dlm_posix_unlock); EXPORT_SYMBOL_GPL(dlm_posix_unlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment