diff options
-rw-r--r-- | fs/nfs/nfs4proc.c | 86 |
1 files changed, 38 insertions, 48 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6630db1336a9..5f2010e0926e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -5144,59 +5144,49 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) | |||
5144 | int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | 5144 | int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) |
5145 | { | 5145 | { |
5146 | struct nfs_server *server = NFS_SERVER(state->inode); | 5146 | struct nfs_server *server = NFS_SERVER(state->inode); |
5147 | struct nfs4_exception exception = { }; | ||
5148 | int err; | 5147 | int err; |
5149 | 5148 | ||
5150 | err = nfs4_set_lock_state(state, fl); | 5149 | err = nfs4_set_lock_state(state, fl); |
5151 | if (err != 0) | 5150 | if (err != 0) |
5152 | goto out; | 5151 | goto out; |
5153 | do { | 5152 | err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); |
5154 | err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); | 5153 | switch (err) { |
5155 | switch (err) { | 5154 | default: |
5156 | default: | 5155 | printk(KERN_ERR "NFS: %s: unhandled error " |
5157 | printk(KERN_ERR "NFS: %s: unhandled error " | 5156 | "%d.\n", __func__, err); |
5158 | "%d.\n", __func__, err); | 5157 | case 0: |
5159 | case 0: | 5158 | case -ESTALE: |
5160 | case -ESTALE: | 5159 | goto out; |
5161 | goto out; | 5160 | case -NFS4ERR_STALE_CLIENTID: |
5162 | case -NFS4ERR_STALE_CLIENTID: | 5161 | case -NFS4ERR_STALE_STATEID: |
5163 | case -NFS4ERR_STALE_STATEID: | 5162 | set_bit(NFS_DELEGATED_STATE, &state->flags); |
5164 | set_bit(NFS_DELEGATED_STATE, &state->flags); | 5163 | case -NFS4ERR_EXPIRED: |
5165 | case -NFS4ERR_EXPIRED: | 5164 | nfs4_schedule_lease_recovery(server->nfs_client); |
5166 | nfs4_schedule_lease_recovery(server->nfs_client); | 5165 | return -EAGAIN; |
5167 | err = -EAGAIN; | 5166 | case -NFS4ERR_BADSESSION: |
5168 | goto out; | 5167 | case -NFS4ERR_BADSLOT: |
5169 | case -NFS4ERR_BADSESSION: | 5168 | case -NFS4ERR_BAD_HIGH_SLOT: |
5170 | case -NFS4ERR_BADSLOT: | 5169 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
5171 | case -NFS4ERR_BAD_HIGH_SLOT: | 5170 | case -NFS4ERR_DEADSESSION: |
5172 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 5171 | set_bit(NFS_DELEGATED_STATE, &state->flags); |
5173 | case -NFS4ERR_DEADSESSION: | 5172 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); |
5174 | set_bit(NFS_DELEGATED_STATE, &state->flags); | 5173 | return -EAGAIN; |
5175 | nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); | 5174 | case -NFS4ERR_DELEG_REVOKED: |
5176 | err = -EAGAIN; | 5175 | case -NFS4ERR_ADMIN_REVOKED: |
5177 | goto out; | 5176 | case -NFS4ERR_BAD_STATEID: |
5178 | case -NFS4ERR_DELEG_REVOKED: | 5177 | case -NFS4ERR_OPENMODE: |
5179 | case -NFS4ERR_ADMIN_REVOKED: | 5178 | nfs4_schedule_stateid_recovery(server, state); |
5180 | case -NFS4ERR_BAD_STATEID: | 5179 | return 0; |
5181 | case -NFS4ERR_OPENMODE: | 5180 | case -NFS4ERR_DELAY: |
5182 | nfs4_schedule_stateid_recovery(server, state); | 5181 | case -NFS4ERR_GRACE: |
5183 | err = 0; | 5182 | set_bit(NFS_DELEGATED_STATE, &state->flags); |
5184 | goto out; | 5183 | ssleep(1); |
5185 | case -NFS4ERR_DELAY: | 5184 | return -EAGAIN; |
5186 | case -NFS4ERR_GRACE: | 5185 | case -ENOMEM: |
5187 | set_bit(NFS_DELEGATED_STATE, &state->flags); | 5186 | case -NFS4ERR_DENIED: |
5188 | ssleep(1); | 5187 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
5189 | err = -EAGAIN; | 5188 | return 0; |
5190 | goto out; | 5189 | } |
5191 | case -ENOMEM: | ||
5192 | case -NFS4ERR_DENIED: | ||
5193 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | ||
5194 | err = 0; | ||
5195 | goto out; | ||
5196 | } | ||
5197 | set_bit(NFS_DELEGATED_STATE, &state->flags); | ||
5198 | err = nfs4_handle_exception(server, err, &exception); | ||
5199 | } while (exception.retry); | ||
5200 | out: | 5190 | out: |
5201 | return err; | 5191 | return err; |
5202 | } | 5192 | } |