aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c06a1ba80d73..fad821991369 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5556,10 +5556,11 @@ out_nfserr:
5556static bool 5556static bool
5557check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner) 5557check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
5558{ 5558{
5559 struct file_lock **flpp; 5559 struct file_lock *fl;
5560 int status = false; 5560 int status = false;
5561 struct file *filp = find_any_file(fp); 5561 struct file *filp = find_any_file(fp);
5562 struct inode *inode; 5562 struct inode *inode;
5563 struct file_lock_context *flctx;
5563 5564
5564 if (!filp) { 5565 if (!filp) {
5565 /* Any valid lock stateid should have some sort of access */ 5566 /* Any valid lock stateid should have some sort of access */
@@ -5568,15 +5569,18 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
5568 } 5569 }
5569 5570
5570 inode = file_inode(filp); 5571 inode = file_inode(filp);
5572 flctx = inode->i_flctx;
5571 5573
5572 spin_lock(&inode->i_lock); 5574 if (flctx && !list_empty_careful(&flctx->flc_posix)) {
5573 for (flpp = &inode->i_flock; *flpp != NULL; flpp = &(*flpp)->fl_next) { 5575 spin_lock(&inode->i_lock);
5574 if ((*flpp)->fl_owner == (fl_owner_t)lowner) { 5576 list_for_each_entry(fl, &flctx->flc_posix, fl_list) {
5575 status = true; 5577 if (fl->fl_owner == (fl_owner_t)lowner) {
5576 break; 5578 status = true;
5579 break;
5580 }
5577 } 5581 }
5582 spin_unlock(&inode->i_lock);
5578 } 5583 }
5579 spin_unlock(&inode->i_lock);
5580 fput(filp); 5584 fput(filp);
5581 return status; 5585 return status;
5582} 5586}