summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 11:29:34 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 11:29:34 -0700
commit8c55f1463c1fd318d5e785f02b80bcc32176d342 (patch)
tree5b22ce63d1cae899384a82869a7d1693e32f2c71 /fs
parent8728f986fe29d872dc5dc72941088eb9cb8bc723 (diff)
parent900083183959107159f962b83b3b439d53796499 (diff)
downloadlinux-3.10-8c55f1463c1fd318d5e785f02b80bcc32176d342.tar.gz
linux-3.10-8c55f1463c1fd318d5e785f02b80bcc32176d342.tar.bz2
linux-3.10-8c55f1463c1fd318d5e785f02b80bcc32176d342.zip
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
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/plock.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 01fd5c11a7f..f704458ea5f 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -247,6 +247,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct dlm_ls *ls;
struct plock_op *op;
int rv;
+ unsigned char fl_flags = fl->fl_flags;
ls = dlm_find_lockspace_local(lockspace);
if (!ls)
@@ -258,9 +259,18 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
goto out;
}
- if (posix_lock_file_wait(file, fl) < 0)
- log_error(ls, "dlm_posix_unlock: vfs unlock error %llx",
- (unsigned long long)number);
+ /* cause the vfs unlock to return ENOENT if lock is not found */
+ fl->fl_flags |= FL_EXISTS;
+
+ 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.pid = fl->fl_pid;
@@ -296,9 +306,11 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
if (rv == -ENOENT)
rv = 0;
+out_free:
kfree(op);
out:
dlm_put_lockspace(ls);
+ fl->fl_flags = fl_flags;
return rv;
}
EXPORT_SYMBOL_GPL(dlm_posix_unlock);