diff options
-rw-r--r-- | fs/nfs/nfs4proc.c | 37 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 3 |
2 files changed, 24 insertions, 16 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1bb0be36a726..8491d775e23c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -82,8 +82,8 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, | |||
82 | struct nfs_fattr *fattr, struct iattr *sattr, | 82 | struct nfs_fattr *fattr, struct iattr *sattr, |
83 | struct nfs4_state *state); | 83 | struct nfs4_state *state); |
84 | #ifdef CONFIG_NFS_V4_1 | 84 | #ifdef CONFIG_NFS_V4_1 |
85 | static int nfs41_test_stateid(struct nfs_server *, struct nfs4_state *); | 85 | static int nfs41_test_stateid(struct nfs_server *, nfs4_stateid *); |
86 | static int nfs41_free_stateid(struct nfs_server *, struct nfs4_state *); | 86 | static int nfs41_free_stateid(struct nfs_server *, nfs4_stateid *); |
87 | #endif | 87 | #endif |
88 | /* Prevent leaks of NFSv4 errors into userland */ | 88 | /* Prevent leaks of NFSv4 errors into userland */ |
89 | static int nfs4_map_errors(int err) | 89 | static int nfs4_map_errors(int err) |
@@ -1728,10 +1728,10 @@ static int nfs41_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st | |||
1728 | int status; | 1728 | int status; |
1729 | struct nfs_server *server = NFS_SERVER(state->inode); | 1729 | struct nfs_server *server = NFS_SERVER(state->inode); |
1730 | 1730 | ||
1731 | status = nfs41_test_stateid(server, state); | 1731 | status = nfs41_test_stateid(server, &state->stateid); |
1732 | if (status == NFS_OK) | 1732 | if (status == NFS_OK) |
1733 | return 0; | 1733 | return 0; |
1734 | nfs41_free_stateid(server, state); | 1734 | nfs41_free_stateid(server, &state->stateid); |
1735 | return nfs4_open_expired(sp, state); | 1735 | return nfs4_open_expired(sp, state); |
1736 | } | 1736 | } |
1737 | #endif | 1737 | #endif |
@@ -4509,10 +4509,10 @@ static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *reques | |||
4509 | int status; | 4509 | int status; |
4510 | struct nfs_server *server = NFS_SERVER(state->inode); | 4510 | struct nfs_server *server = NFS_SERVER(state->inode); |
4511 | 4511 | ||
4512 | status = nfs41_test_stateid(server, state); | 4512 | status = nfs41_test_stateid(server, &state->stateid); |
4513 | if (status == NFS_OK) | 4513 | if (status == NFS_OK) |
4514 | return 0; | 4514 | return 0; |
4515 | nfs41_free_stateid(server, state); | 4515 | nfs41_free_stateid(server, &state->stateid); |
4516 | return nfs4_lock_expired(state, request); | 4516 | return nfs4_lock_expired(state, request); |
4517 | } | 4517 | } |
4518 | #endif | 4518 | #endif |
@@ -6142,10 +6142,12 @@ out_freepage: | |||
6142 | out: | 6142 | out: |
6143 | return err; | 6143 | return err; |
6144 | } | 6144 | } |
6145 | static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state) | 6145 | |
6146 | static int _nfs41_test_stateid(struct nfs_server *server, nfs4_stateid *stateid) | ||
6146 | { | 6147 | { |
6148 | int status; | ||
6147 | struct nfs41_test_stateid_args args = { | 6149 | struct nfs41_test_stateid_args args = { |
6148 | .stateid = &state->stateid, | 6150 | .stateid = stateid, |
6149 | }; | 6151 | }; |
6150 | struct nfs41_test_stateid_res res; | 6152 | struct nfs41_test_stateid_res res; |
6151 | struct rpc_message msg = { | 6153 | struct rpc_message msg = { |
@@ -6153,26 +6155,31 @@ static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *sta | |||
6153 | .rpc_argp = &args, | 6155 | .rpc_argp = &args, |
6154 | .rpc_resp = &res, | 6156 | .rpc_resp = &res, |
6155 | }; | 6157 | }; |
6158 | |||
6156 | nfs41_init_sequence(&args.seq_args, &res.seq_res, 0); | 6159 | nfs41_init_sequence(&args.seq_args, &res.seq_res, 0); |
6157 | return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); | 6160 | status = nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); |
6161 | |||
6162 | if (status == NFS_OK) | ||
6163 | return res.status; | ||
6164 | return status; | ||
6158 | } | 6165 | } |
6159 | 6166 | ||
6160 | static int nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state) | 6167 | static int nfs41_test_stateid(struct nfs_server *server, nfs4_stateid *stateid) |
6161 | { | 6168 | { |
6162 | struct nfs4_exception exception = { }; | 6169 | struct nfs4_exception exception = { }; |
6163 | int err; | 6170 | int err; |
6164 | do { | 6171 | do { |
6165 | err = nfs4_handle_exception(server, | 6172 | err = nfs4_handle_exception(server, |
6166 | _nfs41_test_stateid(server, state), | 6173 | _nfs41_test_stateid(server, stateid), |
6167 | &exception); | 6174 | &exception); |
6168 | } while (exception.retry); | 6175 | } while (exception.retry); |
6169 | return err; | 6176 | return err; |
6170 | } | 6177 | } |
6171 | 6178 | ||
6172 | static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *state) | 6179 | static int _nfs4_free_stateid(struct nfs_server *server, nfs4_stateid *stateid) |
6173 | { | 6180 | { |
6174 | struct nfs41_free_stateid_args args = { | 6181 | struct nfs41_free_stateid_args args = { |
6175 | .stateid = &state->stateid, | 6182 | .stateid = stateid, |
6176 | }; | 6183 | }; |
6177 | struct nfs41_free_stateid_res res; | 6184 | struct nfs41_free_stateid_res res; |
6178 | struct rpc_message msg = { | 6185 | struct rpc_message msg = { |
@@ -6185,13 +6192,13 @@ static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *stat | |||
6185 | return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); | 6192 | return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); |
6186 | } | 6193 | } |
6187 | 6194 | ||
6188 | static int nfs41_free_stateid(struct nfs_server *server, struct nfs4_state *state) | 6195 | static int nfs41_free_stateid(struct nfs_server *server, nfs4_stateid *stateid) |
6189 | { | 6196 | { |
6190 | struct nfs4_exception exception = { }; | 6197 | struct nfs4_exception exception = { }; |
6191 | int err; | 6198 | int err; |
6192 | do { | 6199 | do { |
6193 | err = nfs4_handle_exception(server, | 6200 | err = nfs4_handle_exception(server, |
6194 | _nfs4_free_stateid(server, state), | 6201 | _nfs4_free_stateid(server, stateid), |
6195 | &exception); | 6202 | &exception); |
6196 | } while (exception.retry); | 6203 | } while (exception.retry); |
6197 | return err; | 6204 | return err; |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index ca288d115b54..5d1caac0656d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -5671,7 +5671,8 @@ static int decode_test_stateid(struct xdr_stream *xdr, | |||
5671 | if (unlikely(!p)) | 5671 | if (unlikely(!p)) |
5672 | goto out_overflow; | 5672 | goto out_overflow; |
5673 | res->status = be32_to_cpup(p++); | 5673 | res->status = be32_to_cpup(p++); |
5674 | return res->status; | 5674 | |
5675 | return status; | ||
5675 | out_overflow: | 5676 | out_overflow: |
5676 | print_overflow_msg(__func__, xdr); | 5677 | print_overflow_msg(__func__, xdr); |
5677 | out: | 5678 | out: |