Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lockd: don't attempt blocking locks on nfs reexports

As in the v4 case, it doesn't work well to block waiting for a lock on
an nfs filesystem.

As in the v4 case, that means we're depending on the client to poll.
It's probably incorrect to depend on that, but I *think* clients do poll
in practice. In any case, it's an improvement over hanging the lockd
thread indefinitely as we currently are.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

J. Bruce Fields and committed by
Chuck Lever
b840be2f f657f8ee

+10 -3
+10 -3
fs/lockd/svclock.c
··· 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 ··· 471 470 struct nlm_cookie *cookie, int reclaim) 472 471 { 473 472 struct nlm_block *block = NULL; 473 + struct inode *inode = nlmsvc_file_inode(file); 474 474 int error; 475 475 int mode; 476 + int async_block = 0; 476 477 __be32 ret; 477 478 478 479 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", 479 - nlmsvc_file_inode(file)->i_sb->s_id, 480 - nlmsvc_file_inode(file)->i_ino, 480 + inode->i_sb->s_id, inode->i_ino, 481 481 lock->fl.fl_type, lock->fl.fl_pid, 482 482 (long long)lock->fl.fl_start, 483 483 (long long)lock->fl.fl_end, 484 484 wait); 485 + 486 + if (inode->i_sb->s_export_op->flags & EXPORT_OP_SYNC_LOCKS) { 487 + async_block = wait; 488 + wait = 0; 489 + } 485 490 486 491 /* Lock file against concurrent access */ 487 492 mutex_lock(&file->f_mutex); ··· 549 542 */ 550 543 if (wait) 551 544 break; 552 - ret = nlm_lck_denied; 545 + ret = async_block ? nlm_lck_blocked : nlm_lck_denied; 553 546 goto out; 554 547 case FILE_LOCK_DEFERRED: 555 548 if (wait)