diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 14:29:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 14:29:34 -0400 |
commit | 8c55f1463c1fd318d5e785f02b80bcc32176d342 (patch) | |
tree | 5b22ce63d1cae899384a82869a7d1693e32f2c71 | |
parent | 8728f986fe29d872dc5dc72941088eb9cb8bc723 (diff) | |
parent | 900083183959107159f962b83b3b439d53796499 (diff) |
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
-rw-r--r-- | fs/dlm/plock.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index 01fd5c11a7fb..f704458ea5f5 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, | |||
247 | struct dlm_ls *ls; | 247 | struct dlm_ls *ls; |
248 | struct plock_op *op; | 248 | struct plock_op *op; |
249 | int rv; | 249 | int rv; |
250 | unsigned char fl_flags = fl->fl_flags; | ||
250 | 251 | ||
251 | ls = dlm_find_lockspace_local(lockspace); | 252 | ls = dlm_find_lockspace_local(lockspace); |
252 | if (!ls) | 253 | if (!ls) |
@@ -258,9 +259,18 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, | |||
258 | goto out; | 259 | goto out; |
259 | } | 260 | } |
260 | 261 | ||
261 | if (posix_lock_file_wait(file, fl) < 0) | 262 | /* cause the vfs unlock to return ENOENT if lock is not found */ |
262 | log_error(ls, "dlm_posix_unlock: vfs unlock error %llx", | 263 | fl->fl_flags |= FL_EXISTS; |
263 | (unsigned long long)number); | 264 | |
265 | rv = posix_lock_file_wait(file, fl); | ||
266 | if (rv == -ENOENT) { | ||
267 | rv = 0; | ||
268 | goto out_free; | ||
269 | } | ||
270 | if (rv < 0) { | ||
271 | log_error(ls, "dlm_posix_unlock: vfs unlock error %d %llx", | ||
272 | rv, (unsigned long long)number); | ||
273 | } | ||
264 | 274 | ||
265 | op->info.optype = DLM_PLOCK_OP_UNLOCK; | 275 | op->info.optype = DLM_PLOCK_OP_UNLOCK; |
266 | op->info.pid = fl->fl_pid; | 276 | op->info.pid = fl->fl_pid; |
@@ -296,9 +306,11 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, | |||
296 | if (rv == -ENOENT) | 306 | if (rv == -ENOENT) |
297 | rv = 0; | 307 | rv = 0; |
298 | 308 | ||
309 | out_free: | ||
299 | kfree(op); | 310 | kfree(op); |
300 | out: | 311 | out: |
301 | dlm_put_lockspace(ls); | 312 | dlm_put_lockspace(ls); |
313 | fl->fl_flags = fl_flags; | ||
302 | return rv; | 314 | return rv; |
303 | } | 315 | } |
304 | EXPORT_SYMBOL_GPL(dlm_posix_unlock); | 316 | EXPORT_SYMBOL_GPL(dlm_posix_unlock); |