aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-06-17 16:23:01 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-06-17 16:23:01 -0400
commit5cd973c44a92f4abf8f7084c804089b3eaa7b4bf (patch)
tree7bea559ab6c0a2ab4885a6064147b0cae20b8293
parent3f09df70e3a33590ae5a97b8a15486d3711c7065 (diff)
NFSv4/NLM: Push file locking BKL dependencies down into the NLM layer
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/lockd/clntproc.c2
-rw-r--r--fs/nfs/file.c6
2 files changed, 2 insertions, 6 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index dd7957064a8c..273e229353f3 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -165,6 +165,7 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl)
165 /* Set up the argument struct */ 165 /* Set up the argument struct */
166 nlmclnt_setlockargs(call, fl); 166 nlmclnt_setlockargs(call, fl);
167 167
168 lock_kernel();
168 if (IS_SETLK(cmd) || IS_SETLKW(cmd)) { 169 if (IS_SETLK(cmd) || IS_SETLKW(cmd)) {
169 if (fl->fl_type != F_UNLCK) { 170 if (fl->fl_type != F_UNLCK) {
170 call->a_args.block = IS_SETLKW(cmd) ? 1 : 0; 171 call->a_args.block = IS_SETLKW(cmd) ? 1 : 0;
@@ -178,6 +179,7 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl)
178 179
179 fl->fl_ops->fl_release_private(fl); 180 fl->fl_ops->fl_release_private(fl);
180 fl->fl_ops = NULL; 181 fl->fl_ops = NULL;
182 unlock_kernel();
181 183
182 dprintk("lockd: clnt proc returns %d\n", status); 184 dprintk("lockd: clnt proc returns %d\n", status);
183 return status; 185 return status;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index ec7e27d00bc6..52ed56762583 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -592,7 +592,6 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
592 struct inode *inode = filp->f_mapping->host; 592 struct inode *inode = filp->f_mapping->host;
593 int status = 0; 593 int status = 0;
594 594
595 lock_kernel();
596 /* Try local locking first */ 595 /* Try local locking first */
597 posix_test_lock(filp, fl); 596 posix_test_lock(filp, fl);
598 if (fl->fl_type != F_UNLCK) { 597 if (fl->fl_type != F_UNLCK) {
@@ -608,7 +607,6 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
608 607
609 status = NFS_PROTO(inode)->lock(filp, cmd, fl); 608 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
610out: 609out:
611 unlock_kernel();
612 return status; 610 return status;
613out_noconflict: 611out_noconflict:
614 fl->fl_type = F_UNLCK; 612 fl->fl_type = F_UNLCK;
@@ -650,13 +648,11 @@ static int do_unlk(struct file *filp, int cmd, struct file_lock *fl)
650 * If we're signalled while cleaning up locks on process exit, we 648 * If we're signalled while cleaning up locks on process exit, we
651 * still need to complete the unlock. 649 * still need to complete the unlock.
652 */ 650 */
653 lock_kernel();
654 /* Use local locking if mounted with "-onolock" */ 651 /* Use local locking if mounted with "-onolock" */
655 if (!(NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)) 652 if (!(NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM))
656 status = NFS_PROTO(inode)->lock(filp, cmd, fl); 653 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
657 else 654 else
658 status = do_vfs_lock(filp, fl); 655 status = do_vfs_lock(filp, fl);
659 unlock_kernel();
660 return status; 656 return status;
661} 657}
662 658
@@ -673,13 +669,11 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl)
673 if (status != 0) 669 if (status != 0)
674 goto out; 670 goto out;
675 671
676 lock_kernel();
677 /* Use local locking if mounted with "-onolock" */ 672 /* Use local locking if mounted with "-onolock" */
678 if (!(NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)) 673 if (!(NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM))
679 status = NFS_PROTO(inode)->lock(filp, cmd, fl); 674 status = NFS_PROTO(inode)->lock(filp, cmd, fl);
680 else 675 else
681 status = do_vfs_lock(filp, fl); 676 status = do_vfs_lock(filp, fl);
682 unlock_kernel();
683 if (status < 0) 677 if (status < 0)
684 goto out; 678 goto out;
685 /* 679 /*