diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 21:05:55 +0100 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-01-16 22:08:16 +0100 |
commit | bd61e0a9c852de2d705b6f1bb2cc54c5774db570 (patch) | |
tree | 67a583912923f2ae621bddf94fbba8816cb0e49d /fs/nfs/delegation.c | |
parent | locks: move flock locks to file_lock_context (diff) | |
download | linux-bd61e0a9c852de2d705b6f1bb2cc54c5774db570.tar.xz linux-bd61e0a9c852de2d705b6f1bb2cc54c5774db570.zip |
locks: convert posix locks to file_lock_context
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r-- | fs/nfs/delegation.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 9f9f67b17e2b..3fb1caa3874d 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -85,17 +85,17 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ { struct inode *inode = state->inode; struct file_lock *fl; - struct file_lock_context *flctx; + struct file_lock_context *flctx = inode->i_flctx; + struct list_head *list; int status = 0; - if (inode->i_flock == NULL && inode->i_flctx == NULL) + if (flctx == NULL) goto out; - /* Protect inode->i_flock using the i_lock */ + list = &flctx->flc_posix; spin_lock(&inode->i_lock); - for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { - if (!(fl->fl_flags & (FL_POSIX))) - continue; +restart: + list_for_each_entry(fl, list, fl_list) { if (nfs_file_open_context(fl->fl_file) != ctx) continue; spin_unlock(&inode->i_lock); @@ -104,19 +104,9 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ goto out; spin_lock(&inode->i_lock); } - - flctx = inode->i_flctx; - if (flctx) { - list_for_each_entry(fl, &flctx->flc_flock, fl_list) { - if (nfs_file_open_context(fl->fl_file) != ctx) - continue; - spin_unlock(&inode->i_lock); - status = nfs4_lock_delegation_recall(fl, state, - stateid); - if (status < 0) - goto out; - spin_lock(&inode->i_lock); - } + if (list == &flctx->flc_posix) { + list = &flctx->flc_flock; + goto restart; } spin_unlock(&inode->i_lock); out: |