|
@@ -82,8 +82,8 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
|
|
struct nfs_fattr *fattr, struct iattr *sattr,
|
|
struct nfs_fattr *fattr, struct iattr *sattr,
|
|
struct nfs4_state *state);
|
|
struct nfs4_state *state);
|
|
#ifdef CONFIG_NFS_V4_1
|
|
#ifdef CONFIG_NFS_V4_1
|
|
-static int nfs41_test_stateid(struct nfs_server *, struct nfs4_state *);
|
|
|
|
-static int nfs41_free_stateid(struct nfs_server *, struct nfs4_state *);
|
|
|
|
|
|
+static int nfs41_test_stateid(struct nfs_server *, nfs4_stateid *);
|
|
|
|
+static int nfs41_free_stateid(struct nfs_server *, nfs4_stateid *);
|
|
#endif
|
|
#endif
|
|
/* Prevent leaks of NFSv4 errors into userland */
|
|
/* Prevent leaks of NFSv4 errors into userland */
|
|
static int nfs4_map_errors(int err)
|
|
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
|
|
int status;
|
|
int status;
|
|
struct nfs_server *server = NFS_SERVER(state->inode);
|
|
struct nfs_server *server = NFS_SERVER(state->inode);
|
|
|
|
|
|
- status = nfs41_test_stateid(server, state);
|
|
|
|
|
|
+ status = nfs41_test_stateid(server, &state->stateid);
|
|
if (status == NFS_OK)
|
|
if (status == NFS_OK)
|
|
return 0;
|
|
return 0;
|
|
- nfs41_free_stateid(server, state);
|
|
|
|
|
|
+ nfs41_free_stateid(server, &state->stateid);
|
|
return nfs4_open_expired(sp, state);
|
|
return nfs4_open_expired(sp, state);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
@@ -4509,10 +4509,10 @@ static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *reques
|
|
int status;
|
|
int status;
|
|
struct nfs_server *server = NFS_SERVER(state->inode);
|
|
struct nfs_server *server = NFS_SERVER(state->inode);
|
|
|
|
|
|
- status = nfs41_test_stateid(server, state);
|
|
|
|
|
|
+ status = nfs41_test_stateid(server, &state->stateid);
|
|
if (status == NFS_OK)
|
|
if (status == NFS_OK)
|
|
return 0;
|
|
return 0;
|
|
- nfs41_free_stateid(server, state);
|
|
|
|
|
|
+ nfs41_free_stateid(server, &state->stateid);
|
|
return nfs4_lock_expired(state, request);
|
|
return nfs4_lock_expired(state, request);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
@@ -6142,10 +6142,12 @@ out_freepage:
|
|
out:
|
|
out:
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
-static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state)
|
|
|
|
|
|
+
|
|
|
|
+static int _nfs41_test_stateid(struct nfs_server *server, nfs4_stateid *stateid)
|
|
{
|
|
{
|
|
|
|
+ int status;
|
|
struct nfs41_test_stateid_args args = {
|
|
struct nfs41_test_stateid_args args = {
|
|
- .stateid = &state->stateid,
|
|
|
|
|
|
+ .stateid = stateid,
|
|
};
|
|
};
|
|
struct nfs41_test_stateid_res res;
|
|
struct nfs41_test_stateid_res res;
|
|
struct rpc_message msg = {
|
|
struct rpc_message msg = {
|
|
@@ -6153,26 +6155,31 @@ static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *sta
|
|
.rpc_argp = &args,
|
|
.rpc_argp = &args,
|
|
.rpc_resp = &res,
|
|
.rpc_resp = &res,
|
|
};
|
|
};
|
|
|
|
+
|
|
nfs41_init_sequence(&args.seq_args, &res.seq_res, 0);
|
|
nfs41_init_sequence(&args.seq_args, &res.seq_res, 0);
|
|
- return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
|
|
|
|
|
|
+ status = nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
|
|
|
|
+
|
|
|
|
+ if (status == NFS_OK)
|
|
|
|
+ return res.status;
|
|
|
|
+ return status;
|
|
}
|
|
}
|
|
|
|
|
|
-static int nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state)
|
|
|
|
|
|
+static int nfs41_test_stateid(struct nfs_server *server, nfs4_stateid *stateid)
|
|
{
|
|
{
|
|
struct nfs4_exception exception = { };
|
|
struct nfs4_exception exception = { };
|
|
int err;
|
|
int err;
|
|
do {
|
|
do {
|
|
err = nfs4_handle_exception(server,
|
|
err = nfs4_handle_exception(server,
|
|
- _nfs41_test_stateid(server, state),
|
|
|
|
|
|
+ _nfs41_test_stateid(server, stateid),
|
|
&exception);
|
|
&exception);
|
|
} while (exception.retry);
|
|
} while (exception.retry);
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *state)
|
|
|
|
|
|
+static int _nfs4_free_stateid(struct nfs_server *server, nfs4_stateid *stateid)
|
|
{
|
|
{
|
|
struct nfs41_free_stateid_args args = {
|
|
struct nfs41_free_stateid_args args = {
|
|
- .stateid = &state->stateid,
|
|
|
|
|
|
+ .stateid = stateid,
|
|
};
|
|
};
|
|
struct nfs41_free_stateid_res res;
|
|
struct nfs41_free_stateid_res res;
|
|
struct rpc_message msg = {
|
|
struct rpc_message msg = {
|
|
@@ -6185,13 +6192,13 @@ static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *stat
|
|
return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
|
|
return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
|
|
}
|
|
}
|
|
|
|
|
|
-static int nfs41_free_stateid(struct nfs_server *server, struct nfs4_state *state)
|
|
|
|
|
|
+static int nfs41_free_stateid(struct nfs_server *server, nfs4_stateid *stateid)
|
|
{
|
|
{
|
|
struct nfs4_exception exception = { };
|
|
struct nfs4_exception exception = { };
|
|
int err;
|
|
int err;
|
|
do {
|
|
do {
|
|
err = nfs4_handle_exception(server,
|
|
err = nfs4_handle_exception(server,
|
|
- _nfs4_free_stateid(server, state),
|
|
|
|
|
|
+ _nfs4_free_stateid(server, stateid),
|
|
&exception);
|
|
&exception);
|
|
} while (exception.retry);
|
|
} while (exception.retry);
|
|
return err;
|
|
return err;
|