diff options
| -rw-r--r-- | fs/nfs/client.c | 18 | ||||
| -rw-r--r-- | fs/nfs/dir.c | 2 | ||||
| -rw-r--r-- | fs/nfs/nfs4_fs.h | 6 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 40 | ||||
| -rw-r--r-- | fs/nfs/nfs4state.c | 2 |
5 files changed, 40 insertions, 28 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index c2d061675d80..8d25ccb2d51d 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
| @@ -1242,20 +1242,6 @@ error: | |||
| 1242 | return error; | 1242 | return error; |
| 1243 | } | 1243 | } |
| 1244 | 1244 | ||
| 1245 | /* | ||
| 1246 | * Initialize a session. | ||
| 1247 | * Note: save the mount rsize and wsize for create_server negotiation. | ||
| 1248 | */ | ||
| 1249 | static void nfs4_init_session(struct nfs_client *clp, | ||
| 1250 | unsigned int wsize, unsigned int rsize) | ||
| 1251 | { | ||
| 1252 | #if defined(CONFIG_NFS_V4_1) | ||
| 1253 | if (nfs4_has_session(clp)) { | ||
| 1254 | clp->cl_session->fc_attrs.max_rqst_sz = wsize; | ||
| 1255 | clp->cl_session->fc_attrs.max_resp_sz = rsize; | ||
| 1256 | } | ||
| 1257 | #endif /* CONFIG_NFS_V4_1 */ | ||
| 1258 | } | ||
| 1259 | 1245 | ||
| 1260 | /* | 1246 | /* |
| 1261 | * Session has been established, and the client marked ready. | 1247 | * Session has been established, and the client marked ready. |
| @@ -1350,7 +1336,9 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data, | |||
| 1350 | BUG_ON(!server->nfs_client->rpc_ops); | 1336 | BUG_ON(!server->nfs_client->rpc_ops); |
| 1351 | BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); | 1337 | BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); |
| 1352 | 1338 | ||
| 1353 | nfs4_init_session(server->nfs_client, server->wsize, server->rsize); | 1339 | error = nfs4_init_session(server); |
| 1340 | if (error < 0) | ||
| 1341 | goto error; | ||
| 1354 | 1342 | ||
| 1355 | /* Probe the root fh to retrieve its FSID */ | 1343 | /* Probe the root fh to retrieve its FSID */ |
| 1356 | error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path); | 1344 | error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path); |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 38d42c29fb92..32062c33c859 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1025,12 +1025,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry | |||
| 1025 | res = NULL; | 1025 | res = NULL; |
| 1026 | goto out; | 1026 | goto out; |
| 1027 | /* This turned out not to be a regular file */ | 1027 | /* This turned out not to be a regular file */ |
| 1028 | case -EISDIR: | ||
| 1029 | case -ENOTDIR: | 1028 | case -ENOTDIR: |
| 1030 | goto no_open; | 1029 | goto no_open; |
| 1031 | case -ELOOP: | 1030 | case -ELOOP: |
| 1032 | if (!(nd->intent.open.flags & O_NOFOLLOW)) | 1031 | if (!(nd->intent.open.flags & O_NOFOLLOW)) |
| 1033 | goto no_open; | 1032 | goto no_open; |
| 1033 | /* case -EISDIR: */ | ||
| 1034 | /* case -EINVAL: */ | 1034 | /* case -EINVAL: */ |
| 1035 | default: | 1035 | default: |
| 1036 | goto out; | 1036 | goto out; |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 61bc3a32e1e2..6ea07a3c75d4 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -220,6 +220,7 @@ extern void nfs4_destroy_session(struct nfs4_session *session); | |||
| 220 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); | 220 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); |
| 221 | extern int nfs4_proc_create_session(struct nfs_client *, int reset); | 221 | extern int nfs4_proc_create_session(struct nfs_client *, int reset); |
| 222 | extern int nfs4_proc_destroy_session(struct nfs4_session *); | 222 | extern int nfs4_proc_destroy_session(struct nfs4_session *); |
| 223 | extern int nfs4_init_session(struct nfs_server *server); | ||
| 223 | #else /* CONFIG_NFS_v4_1 */ | 224 | #else /* CONFIG_NFS_v4_1 */ |
| 224 | static inline int nfs4_setup_sequence(struct nfs_client *clp, | 225 | static inline int nfs4_setup_sequence(struct nfs_client *clp, |
| 225 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, | 226 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, |
| @@ -227,6 +228,11 @@ static inline int nfs4_setup_sequence(struct nfs_client *clp, | |||
| 227 | { | 228 | { |
| 228 | return 0; | 229 | return 0; |
| 229 | } | 230 | } |
| 231 | |||
| 232 | static inline int nfs4_init_session(struct nfs_server *server) | ||
| 233 | { | ||
| 234 | return 0; | ||
| 235 | } | ||
| 230 | #endif /* CONFIG_NFS_V4_1 */ | 236 | #endif /* CONFIG_NFS_V4_1 */ |
| 231 | 237 | ||
| 232 | extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; | 238 | extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ff0c080db59b..6917311f201c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -2040,15 +2040,9 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 2040 | .rpc_argp = &args, | 2040 | .rpc_argp = &args, |
| 2041 | .rpc_resp = &res, | 2041 | .rpc_resp = &res, |
| 2042 | }; | 2042 | }; |
| 2043 | int status; | ||
| 2044 | 2043 | ||
| 2045 | nfs_fattr_init(info->fattr); | 2044 | nfs_fattr_init(info->fattr); |
| 2046 | status = nfs4_recover_expired_lease(server); | 2045 | return nfs4_call_sync(server, &msg, &args, &res, 0); |
| 2047 | if (!status) | ||
| 2048 | status = nfs4_check_client_ready(server->nfs_client); | ||
| 2049 | if (!status) | ||
| 2050 | status = nfs4_call_sync(server, &msg, &args, &res, 0); | ||
| 2051 | return status; | ||
| 2052 | } | 2046 | } |
| 2053 | 2047 | ||
| 2054 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | 2048 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, |
| @@ -4099,15 +4093,23 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) | |||
| 4099 | if (request->fl_start < 0 || request->fl_end < 0) | 4093 | if (request->fl_start < 0 || request->fl_end < 0) |
| 4100 | return -EINVAL; | 4094 | return -EINVAL; |
| 4101 | 4095 | ||
| 4102 | if (IS_GETLK(cmd)) | 4096 | if (IS_GETLK(cmd)) { |
| 4103 | return nfs4_proc_getlk(state, F_GETLK, request); | 4097 | if (state != NULL) |
| 4098 | return nfs4_proc_getlk(state, F_GETLK, request); | ||
| 4099 | return 0; | ||
| 4100 | } | ||
| 4104 | 4101 | ||
| 4105 | if (!(IS_SETLK(cmd) || IS_SETLKW(cmd))) | 4102 | if (!(IS_SETLK(cmd) || IS_SETLKW(cmd))) |
| 4106 | return -EINVAL; | 4103 | return -EINVAL; |
| 4107 | 4104 | ||
| 4108 | if (request->fl_type == F_UNLCK) | 4105 | if (request->fl_type == F_UNLCK) { |
| 4109 | return nfs4_proc_unlck(state, cmd, request); | 4106 | if (state != NULL) |
| 4107 | return nfs4_proc_unlck(state, cmd, request); | ||
| 4108 | return 0; | ||
| 4109 | } | ||
| 4110 | 4110 | ||
| 4111 | if (state == NULL) | ||
| 4112 | return -ENOLCK; | ||
| 4111 | do { | 4113 | do { |
| 4112 | status = nfs4_proc_setlk(state, cmd, request); | 4114 | status = nfs4_proc_setlk(state, cmd, request); |
| 4113 | if ((status != -EAGAIN) || IS_SETLK(cmd)) | 4115 | if ((status != -EAGAIN) || IS_SETLK(cmd)) |
| @@ -4793,6 +4795,22 @@ int nfs4_proc_destroy_session(struct nfs4_session *session) | |||
| 4793 | return status; | 4795 | return status; |
| 4794 | } | 4796 | } |
| 4795 | 4797 | ||
| 4798 | int nfs4_init_session(struct nfs_server *server) | ||
| 4799 | { | ||
| 4800 | struct nfs_client *clp = server->nfs_client; | ||
| 4801 | int ret; | ||
| 4802 | |||
| 4803 | if (!nfs4_has_session(clp)) | ||
| 4804 | return 0; | ||
| 4805 | |||
| 4806 | clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; | ||
| 4807 | clp->cl_session->fc_attrs.max_resp_sz = server->rsize; | ||
| 4808 | ret = nfs4_recover_expired_lease(server); | ||
| 4809 | if (!ret) | ||
| 4810 | ret = nfs4_check_client_ready(clp); | ||
| 4811 | return ret; | ||
| 4812 | } | ||
| 4813 | |||
| 4796 | /* | 4814 | /* |
| 4797 | * Renew the cl_session lease. | 4815 | * Renew the cl_session lease. |
| 4798 | */ | 4816 | */ |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index b73c5a728655..65ca8c18476f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -553,6 +553,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f | |||
| 553 | INIT_LIST_HEAD(&lsp->ls_sequence.list); | 553 | INIT_LIST_HEAD(&lsp->ls_sequence.list); |
| 554 | lsp->ls_seqid.sequence = &lsp->ls_sequence; | 554 | lsp->ls_seqid.sequence = &lsp->ls_sequence; |
| 555 | atomic_set(&lsp->ls_count, 1); | 555 | atomic_set(&lsp->ls_count, 1); |
| 556 | lsp->ls_state = state; | ||
| 556 | lsp->ls_owner = fl_owner; | 557 | lsp->ls_owner = fl_owner; |
| 557 | spin_lock(&clp->cl_lock); | 558 | spin_lock(&clp->cl_lock); |
| 558 | nfs_alloc_unique_id(&clp->cl_lockowner_id, &lsp->ls_id, 1, 64); | 559 | nfs_alloc_unique_id(&clp->cl_lockowner_id, &lsp->ls_id, 1, 64); |
| @@ -587,7 +588,6 @@ static struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_ | |||
| 587 | if (lsp != NULL) | 588 | if (lsp != NULL) |
| 588 | break; | 589 | break; |
| 589 | if (new != NULL) { | 590 | if (new != NULL) { |
| 590 | new->ls_state = state; | ||
| 591 | list_add(&new->ls_locks, &state->lock_states); | 591 | list_add(&new->ls_locks, &state->lock_states); |
| 592 | set_bit(LK_STATE_IN_USE, &state->flags); | 592 | set_bit(LK_STATE_IN_USE, &state->flags); |
| 593 | lsp = new; | 593 | lsp = new; |
