diff options
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r-- | fs/nfs/delegation.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 44135af9894c..3976c177a7d0 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -31,11 +31,42 @@ static void nfs_free_delegation(struct nfs_delegation *delegation) | |||
31 | kfree(delegation); | 31 | kfree(delegation); |
32 | } | 32 | } |
33 | 33 | ||
34 | static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state) | ||
35 | { | ||
36 | struct inode *inode = state->inode; | ||
37 | struct file_lock *fl; | ||
38 | int status; | ||
39 | |||
40 | for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) { | ||
41 | if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) | ||
42 | continue; | ||
43 | if ((struct nfs_open_context *)fl->fl_file->private_data != ctx) | ||
44 | continue; | ||
45 | status = nfs4_lock_delegation_recall(state, fl); | ||
46 | if (status >= 0) | ||
47 | continue; | ||
48 | switch (status) { | ||
49 | default: | ||
50 | printk(KERN_ERR "%s: unhandled error %d.\n", | ||
51 | __FUNCTION__, status); | ||
52 | case -NFS4ERR_EXPIRED: | ||
53 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | ||
54 | case -NFS4ERR_STALE_CLIENTID: | ||
55 | nfs4_schedule_state_recovery(NFS_SERVER(inode)->nfs4_state); | ||
56 | goto out_err; | ||
57 | } | ||
58 | } | ||
59 | return 0; | ||
60 | out_err: | ||
61 | return status; | ||
62 | } | ||
63 | |||
34 | static void nfs_delegation_claim_opens(struct inode *inode) | 64 | static void nfs_delegation_claim_opens(struct inode *inode) |
35 | { | 65 | { |
36 | struct nfs_inode *nfsi = NFS_I(inode); | 66 | struct nfs_inode *nfsi = NFS_I(inode); |
37 | struct nfs_open_context *ctx; | 67 | struct nfs_open_context *ctx; |
38 | struct nfs4_state *state; | 68 | struct nfs4_state *state; |
69 | int err; | ||
39 | 70 | ||
40 | again: | 71 | again: |
41 | spin_lock(&inode->i_lock); | 72 | spin_lock(&inode->i_lock); |
@@ -47,9 +78,12 @@ again: | |||
47 | continue; | 78 | continue; |
48 | get_nfs_open_context(ctx); | 79 | get_nfs_open_context(ctx); |
49 | spin_unlock(&inode->i_lock); | 80 | spin_unlock(&inode->i_lock); |
50 | if (nfs4_open_delegation_recall(ctx->dentry, state) < 0) | 81 | err = nfs4_open_delegation_recall(ctx->dentry, state); |
51 | return; | 82 | if (err >= 0) |
83 | err = nfs_delegation_claim_locks(ctx, state); | ||
52 | put_nfs_open_context(ctx); | 84 | put_nfs_open_context(ctx); |
85 | if (err != 0) | ||
86 | return; | ||
53 | goto again; | 87 | goto again; |
54 | } | 88 | } |
55 | spin_unlock(&inode->i_lock); | 89 | spin_unlock(&inode->i_lock); |