diff options
author | Alexandros Batsakis <batsakis@netapp.com> | 2009-12-09 04:50:14 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-15 13:50:32 -0500 |
commit | afe6c27ccb8cc31ce8ed0bd3589ce549f523c8e7 (patch) | |
tree | 5c87de95a9ef12106648e7dfbf4640c58279e730 | |
parent | 0f7e720694e88bacf808b525069fb72d1c237171 (diff) |
nfs: change nfs4_do_setlk params to identify recovery type
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4_fs.h | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 7e57b04e4014..e8791d5a2f7a 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -108,6 +108,10 @@ enum { | |||
108 | NFS_OWNER_RECLAIM_NOGRACE | 108 | NFS_OWNER_RECLAIM_NOGRACE |
109 | }; | 109 | }; |
110 | 110 | ||
111 | #define NFS_LOCK_NEW 0 | ||
112 | #define NFS_LOCK_RECLAIM 1 | ||
113 | #define NFS_LOCK_EXPIRED 2 | ||
114 | |||
111 | /* | 115 | /* |
112 | * struct nfs4_state maintains the client-side state for a given | 116 | * struct nfs4_state maintains the client-side state for a given |
113 | * (state_owner,inode) tuple (OPEN) or state_owner (LOCK). | 117 | * (state_owner,inode) tuple (OPEN) or state_owner (LOCK). |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 297e23310efd..d44f1071930f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4002,7 +4002,7 @@ static const struct rpc_call_ops nfs4_lock_ops = { | |||
4002 | .rpc_release = nfs4_lock_release, | 4002 | .rpc_release = nfs4_lock_release, |
4003 | }; | 4003 | }; |
4004 | 4004 | ||
4005 | static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int reclaim) | 4005 | static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int recovery_type) |
4006 | { | 4006 | { |
4007 | struct nfs4_lockdata *data; | 4007 | struct nfs4_lockdata *data; |
4008 | struct rpc_task *task; | 4008 | struct rpc_task *task; |
@@ -4026,8 +4026,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
4026 | return -ENOMEM; | 4026 | return -ENOMEM; |
4027 | if (IS_SETLKW(cmd)) | 4027 | if (IS_SETLKW(cmd)) |
4028 | data->arg.block = 1; | 4028 | data->arg.block = 1; |
4029 | if (reclaim != 0) | 4029 | if (recovery_type == NFS_LOCK_RECLAIM) |
4030 | data->arg.reclaim = 1; | 4030 | data->arg.reclaim = NFS_LOCK_RECLAIM; |
4031 | msg.rpc_argp = &data->arg, | 4031 | msg.rpc_argp = &data->arg, |
4032 | msg.rpc_resp = &data->res, | 4032 | msg.rpc_resp = &data->res, |
4033 | task_setup_data.callback_data = data; | 4033 | task_setup_data.callback_data = data; |
@@ -4054,7 +4054,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request | |||
4054 | /* Cache the lock if possible... */ | 4054 | /* Cache the lock if possible... */ |
4055 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) | 4055 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) |
4056 | return 0; | 4056 | return 0; |
4057 | err = _nfs4_do_setlk(state, F_SETLK, request, 1); | 4057 | err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_RECLAIM); |
4058 | if (err != -NFS4ERR_DELAY) | 4058 | if (err != -NFS4ERR_DELAY) |
4059 | break; | 4059 | break; |
4060 | nfs4_handle_exception(server, err, &exception); | 4060 | nfs4_handle_exception(server, err, &exception); |
@@ -4074,7 +4074,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request | |||
4074 | do { | 4074 | do { |
4075 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) | 4075 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) |
4076 | return 0; | 4076 | return 0; |
4077 | err = _nfs4_do_setlk(state, F_SETLK, request, 0); | 4077 | err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_EXPIRED); |
4078 | switch (err) { | 4078 | switch (err) { |
4079 | default: | 4079 | default: |
4080 | goto out; | 4080 | goto out; |
@@ -4110,7 +4110,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
4110 | status = do_vfs_lock(request->fl_file, request); | 4110 | status = do_vfs_lock(request->fl_file, request); |
4111 | goto out_unlock; | 4111 | goto out_unlock; |
4112 | } | 4112 | } |
4113 | status = _nfs4_do_setlk(state, cmd, request, 0); | 4113 | status = _nfs4_do_setlk(state, cmd, request, NFS_LOCK_NEW); |
4114 | if (status != 0) | 4114 | if (status != 0) |
4115 | goto out_unlock; | 4115 | goto out_unlock; |
4116 | /* Note: we always want to sleep here! */ | 4116 | /* Note: we always want to sleep here! */ |
@@ -4193,7 +4193,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4193 | if (err != 0) | 4193 | if (err != 0) |
4194 | goto out; | 4194 | goto out; |
4195 | do { | 4195 | do { |
4196 | err = _nfs4_do_setlk(state, F_SETLK, fl, 0); | 4196 | err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); |
4197 | switch (err) { | 4197 | switch (err) { |
4198 | default: | 4198 | default: |
4199 | printk(KERN_ERR "%s: unhandled error %d.\n", | 4199 | printk(KERN_ERR "%s: unhandled error %d.\n", |