aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2015-02-02 11:29:29 -0500
committerJ. Bruce Fields <bfields@redhat.com>2015-02-02 11:29:29 -0500
commita584143b01ce69803116ae8d0a4db382acc728d7 (patch)
tree002733709647fa1e17683a9d21dbc23ae99e3d2d /fs/nfsd/nfs4state.c
parent4c94e13e9caed09103419c087f436d79f9d2faba (diff)
parent8116bf4cb62d337c953cfa5369ef4cf83e73140c (diff)
Merge branch 'locks-3.20' of git://git.samba.org/jlayton/linux into for-3.20
Christoph's block pnfs patches have some minor dependencies on these lock patches.
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1f4b85b15125..370a53a5da13 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3472,7 +3472,8 @@ nfsd_break_deleg_cb(struct file_lock *fl)
3472} 3472}
3473 3473
3474static int 3474static int
3475nfsd_change_deleg_cb(struct file_lock **onlist, int arg, struct list_head *dispose) 3475nfsd_change_deleg_cb(struct file_lock *onlist, int arg,
3476 struct list_head *dispose)
3476{ 3477{
3477 if (arg & F_UNLCK) 3478 if (arg & F_UNLCK)
3478 return lease_modify(onlist, arg, dispose); 3479 return lease_modify(onlist, arg, dispose);
@@ -5551,10 +5552,11 @@ out_nfserr:
5551static bool 5552static bool
5552check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner) 5553check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
5553{ 5554{
5554 struct file_lock **flpp; 5555 struct file_lock *fl;
5555 int status = false; 5556 int status = false;
5556 struct file *filp = find_any_file(fp); 5557 struct file *filp = find_any_file(fp);
5557 struct inode *inode; 5558 struct inode *inode;
5559 struct file_lock_context *flctx;
5558 5560
5559 if (!filp) { 5561 if (!filp) {
5560 /* Any valid lock stateid should have some sort of access */ 5562 /* Any valid lock stateid should have some sort of access */
@@ -5563,15 +5565,18 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
5563 } 5565 }
5564 5566
5565 inode = file_inode(filp); 5567 inode = file_inode(filp);
5568 flctx = inode->i_flctx;
5566 5569
5567 spin_lock(&inode->i_lock); 5570 if (flctx && !list_empty_careful(&flctx->flc_posix)) {
5568 for (flpp = &inode->i_flock; *flpp != NULL; flpp = &(*flpp)->fl_next) { 5571 spin_lock(&flctx->flc_lock);
5569 if ((*flpp)->fl_owner == (fl_owner_t)lowner) { 5572 list_for_each_entry(fl, &flctx->flc_posix, fl_list) {
5570 status = true; 5573 if (fl->fl_owner == (fl_owner_t)lowner) {
5571 break; 5574 status = true;
5575 break;
5576 }
5572 } 5577 }
5578 spin_unlock(&flctx->flc_lock);
5573 } 5579 }
5574 spin_unlock(&inode->i_lock);
5575 fput(filp); 5580 fput(filp);
5576 return status; 5581 return status;
5577} 5582}