mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
NFS: Split out the nfs40_mig_recovery_ops to nfs40proc.c
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
This commit is contained in:
parent
963707b122
commit
b6ee9a9ba7
|
|
@ -8,6 +8,7 @@ extern const struct rpc_call_ops nfs40_call_sync_ops;
|
|||
extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
|
||||
extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
|
||||
extern const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops;
|
||||
extern const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops;
|
||||
|
||||
/* nfs40state.c */
|
||||
int nfs40_discover_server_trunking(struct nfs_client *clp,
|
||||
|
|
|
|||
|
|
@ -126,6 +126,102 @@ static int nfs4_proc_renew(struct nfs_client *clp, const struct cred *cred)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This operation also signals the server that this client is
|
||||
* performing migration recovery. The server can stop returning
|
||||
* NFS4ERR_LEASE_MOVED to this client. A RENEW operation is
|
||||
* appended to this compound to identify the client ID which is
|
||||
* performing recovery.
|
||||
*/
|
||||
static int _nfs40_proc_get_locations(struct nfs_server *server,
|
||||
struct nfs_fh *fhandle,
|
||||
struct nfs4_fs_locations *locations,
|
||||
struct page *page, const struct cred *cred)
|
||||
{
|
||||
struct rpc_clnt *clnt = server->client;
|
||||
u32 bitmask[2] = {
|
||||
[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
|
||||
};
|
||||
struct nfs4_fs_locations_arg args = {
|
||||
.clientid = server->nfs_client->cl_clientid,
|
||||
.fh = fhandle,
|
||||
.page = page,
|
||||
.bitmask = bitmask,
|
||||
.migration = 1, /* skip LOOKUP */
|
||||
.renew = 1, /* append RENEW */
|
||||
};
|
||||
struct nfs4_fs_locations_res res = {
|
||||
.fs_locations = locations,
|
||||
.migration = 1,
|
||||
.renew = 1,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FS_LOCATIONS],
|
||||
.rpc_argp = &args,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = cred,
|
||||
};
|
||||
unsigned long now = jiffies;
|
||||
int status;
|
||||
|
||||
nfs_fattr_init(locations->fattr);
|
||||
locations->server = server;
|
||||
locations->nlocations = 0;
|
||||
|
||||
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
|
||||
status = nfs4_call_sync_sequence(clnt, server, &msg,
|
||||
&args.seq_args, &res.seq_res);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
renew_lease(server, now);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This operation also signals the server that this client is
|
||||
* performing "lease moved" recovery. The server can stop
|
||||
* returning NFS4ERR_LEASE_MOVED to this client. A RENEW operation
|
||||
* is appended to this compound to identify the client ID which is
|
||||
* performing recovery.
|
||||
*/
|
||||
static int _nfs40_proc_fsid_present(struct inode *inode, const struct cred *cred)
|
||||
{
|
||||
struct nfs_server *server = NFS_SERVER(inode);
|
||||
struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
|
||||
struct rpc_clnt *clnt = server->client;
|
||||
struct nfs4_fsid_present_arg args = {
|
||||
.fh = NFS_FH(inode),
|
||||
.clientid = clp->cl_clientid,
|
||||
.renew = 1, /* append RENEW */
|
||||
};
|
||||
struct nfs4_fsid_present_res res = {
|
||||
.renew = 1,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSID_PRESENT],
|
||||
.rpc_argp = &args,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = cred,
|
||||
};
|
||||
unsigned long now = jiffies;
|
||||
int status;
|
||||
|
||||
res.fh = nfs_alloc_fhandle();
|
||||
if (res.fh == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
|
||||
status = nfs4_call_sync_sequence(clnt, server, &msg,
|
||||
&args.seq_args, &res.seq_res);
|
||||
nfs_free_fhandle(res.fh);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
do_renew_lease(clp, now);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct rpc_call_ops nfs40_call_sync_ops = {
|
||||
.rpc_call_prepare = nfs40_call_sync_prepare,
|
||||
.rpc_call_done = nfs40_call_sync_done,
|
||||
|
|
@ -153,3 +249,8 @@ const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = {
|
|||
.get_state_renewal_cred = nfs4_get_renew_cred,
|
||||
.renew_lease = nfs4_proc_renew,
|
||||
};
|
||||
|
||||
const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops = {
|
||||
.get_locations = _nfs40_proc_get_locations,
|
||||
.fsid_present = _nfs40_proc_fsid_present,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -304,9 +304,15 @@ extern int nfs4_async_handle_error(struct rpc_task *task,
|
|||
extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
|
||||
struct rpc_message *, struct nfs4_sequence_args *,
|
||||
struct nfs4_sequence_res *, int);
|
||||
extern int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
|
||||
struct nfs_server *server,
|
||||
struct rpc_message *msg,
|
||||
struct nfs4_sequence_args *args,
|
||||
struct nfs4_sequence_res *res);
|
||||
extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
|
||||
extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *);
|
||||
extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *);
|
||||
extern void renew_lease(const struct nfs_server *server, unsigned long timestamp);
|
||||
extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *,
|
||||
struct nfs_fattr *, bool);
|
||||
extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, const struct cred *cred);
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ void do_renew_lease(struct nfs_client *clp, unsigned long timestamp)
|
|||
spin_unlock(&clp->cl_lock);
|
||||
}
|
||||
|
||||
static void renew_lease(const struct nfs_server *server, unsigned long timestamp)
|
||||
void renew_lease(const struct nfs_server *server, unsigned long timestamp)
|
||||
{
|
||||
struct nfs_client *clp = server->nfs_client;
|
||||
|
||||
|
|
@ -1207,11 +1207,11 @@ static int nfs4_do_call_sync(struct rpc_clnt *clnt,
|
|||
return nfs4_call_sync_custom(&task_setup);
|
||||
}
|
||||
|
||||
static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
|
||||
struct nfs_server *server,
|
||||
struct rpc_message *msg,
|
||||
struct nfs4_sequence_args *args,
|
||||
struct nfs4_sequence_res *res)
|
||||
int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
|
||||
struct nfs_server *server,
|
||||
struct rpc_message *msg,
|
||||
struct nfs4_sequence_args *args,
|
||||
struct nfs4_sequence_res *res)
|
||||
{
|
||||
unsigned short task_flags = 0;
|
||||
|
||||
|
|
@ -8279,58 +8279,6 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* This operation also signals the server that this client is
|
||||
* performing migration recovery. The server can stop returning
|
||||
* NFS4ERR_LEASE_MOVED to this client. A RENEW operation is
|
||||
* appended to this compound to identify the client ID which is
|
||||
* performing recovery.
|
||||
*/
|
||||
static int _nfs40_proc_get_locations(struct nfs_server *server,
|
||||
struct nfs_fh *fhandle,
|
||||
struct nfs4_fs_locations *locations,
|
||||
struct page *page, const struct cred *cred)
|
||||
{
|
||||
struct rpc_clnt *clnt = server->client;
|
||||
u32 bitmask[2] = {
|
||||
[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
|
||||
};
|
||||
struct nfs4_fs_locations_arg args = {
|
||||
.clientid = server->nfs_client->cl_clientid,
|
||||
.fh = fhandle,
|
||||
.page = page,
|
||||
.bitmask = bitmask,
|
||||
.migration = 1, /* skip LOOKUP */
|
||||
.renew = 1, /* append RENEW */
|
||||
};
|
||||
struct nfs4_fs_locations_res res = {
|
||||
.fs_locations = locations,
|
||||
.migration = 1,
|
||||
.renew = 1,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FS_LOCATIONS],
|
||||
.rpc_argp = &args,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = cred,
|
||||
};
|
||||
unsigned long now = jiffies;
|
||||
int status;
|
||||
|
||||
nfs_fattr_init(locations->fattr);
|
||||
locations->server = server;
|
||||
locations->nlocations = 0;
|
||||
|
||||
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
|
||||
status = nfs4_call_sync_sequence(clnt, server, &msg,
|
||||
&args.seq_args, &res.seq_res);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
renew_lease(server, now);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFS_V4_1
|
||||
|
||||
/*
|
||||
|
|
@ -8443,50 +8391,6 @@ int nfs4_proc_get_locations(struct nfs_server *server,
|
|||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* This operation also signals the server that this client is
|
||||
* performing "lease moved" recovery. The server can stop
|
||||
* returning NFS4ERR_LEASE_MOVED to this client. A RENEW operation
|
||||
* is appended to this compound to identify the client ID which is
|
||||
* performing recovery.
|
||||
*/
|
||||
static int _nfs40_proc_fsid_present(struct inode *inode, const struct cred *cred)
|
||||
{
|
||||
struct nfs_server *server = NFS_SERVER(inode);
|
||||
struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
|
||||
struct rpc_clnt *clnt = server->client;
|
||||
struct nfs4_fsid_present_arg args = {
|
||||
.fh = NFS_FH(inode),
|
||||
.clientid = clp->cl_clientid,
|
||||
.renew = 1, /* append RENEW */
|
||||
};
|
||||
struct nfs4_fsid_present_res res = {
|
||||
.renew = 1,
|
||||
};
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSID_PRESENT],
|
||||
.rpc_argp = &args,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = cred,
|
||||
};
|
||||
unsigned long now = jiffies;
|
||||
int status;
|
||||
|
||||
res.fh = nfs_alloc_fhandle();
|
||||
if (res.fh == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
|
||||
status = nfs4_call_sync_sequence(clnt, server, &msg,
|
||||
&args.seq_args, &res.seq_res);
|
||||
nfs_free_fhandle(res.fh);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
do_renew_lease(clp, now);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFS_V4_1
|
||||
|
||||
/*
|
||||
|
|
@ -10722,14 +10626,7 @@ static const struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = {
|
|||
.get_state_renewal_cred = nfs4_get_machine_cred,
|
||||
.renew_lease = nfs4_proc_sequence,
|
||||
};
|
||||
#endif
|
||||
|
||||
static const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops = {
|
||||
.get_locations = _nfs40_proc_get_locations,
|
||||
.fsid_present = _nfs40_proc_fsid_present,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_NFS_V4_1)
|
||||
static const struct nfs4_mig_recovery_ops nfs41_mig_recovery_ops = {
|
||||
.get_locations = _nfs41_proc_get_locations,
|
||||
.fsid_present = _nfs41_proc_fsid_present,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user