|
31 | 31 | #include <linux/lockd/nlm.h>
|
32 | 32 | #include <linux/lockd/lockd.h>
|
33 | 33 | #include <linux/kthread.h>
|
| 34 | +#include <linux/exportfs.h> |
34 | 35 |
|
35 | 36 | #define NLMDBG_FACILITY NLMDBG_SVCLOCK
|
36 | 37 |
|
@@ -470,18 +471,24 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
|
470 | 471 | struct nlm_cookie *cookie, int reclaim)
|
471 | 472 | {
|
472 | 473 | struct nlm_block *block = NULL;
|
| 474 | + struct inode *inode = nlmsvc_file_inode(file); |
473 | 475 | int error;
|
474 | 476 | int mode;
|
| 477 | + int async_block = 0; |
475 | 478 | __be32 ret;
|
476 | 479 |
|
477 | 480 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
|
478 |
| - nlmsvc_file_inode(file)->i_sb->s_id, |
479 |
| - nlmsvc_file_inode(file)->i_ino, |
| 481 | + inode->i_sb->s_id, inode->i_ino, |
480 | 482 | lock->fl.fl_type, lock->fl.fl_pid,
|
481 | 483 | (long long)lock->fl.fl_start,
|
482 | 484 | (long long)lock->fl.fl_end,
|
483 | 485 | wait);
|
484 | 486 |
|
| 487 | + if (inode->i_sb->s_export_op->flags & EXPORT_OP_SYNC_LOCKS) { |
| 488 | + async_block = wait; |
| 489 | + wait = 0; |
| 490 | + } |
| 491 | + |
485 | 492 | /* Lock file against concurrent access */
|
486 | 493 | mutex_lock(&file->f_mutex);
|
487 | 494 | /* Get existing block (in case client is busy-waiting)
|
@@ -542,7 +549,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
|
542 | 549 | */
|
543 | 550 | if (wait)
|
544 | 551 | break;
|
545 |
| - ret = nlm_lck_denied; |
| 552 | + ret = async_block ? nlm_lck_blocked : nlm_lck_denied; |
546 | 553 | goto out;
|
547 | 554 | case FILE_LOCK_DEFERRED:
|
548 | 555 | if (wait)
|
|
0 commit comments