Commit ce0887ac authored by Olga Kornievskaia's avatar Olga Kornievskaia Committed by J. Bruce Fields

NFSD add nfs4 inter ssc to nfsd4_copy

Given a universal address, mount the source server from the destination
server.  Use an internal mount. Call the NFS client nfs42_ssc_open to
obtain the NFS struct file suitable for nfsd_copy_range.

Ability to do "inter" server-to-server depends on the an nfsd kernel
parameter "inter_copy_offload_enable".
Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
parent b9e8638e
This diff is collapsed.
...@@ -5681,8 +5681,9 @@ _free_cpntf_state_locked(struct nfsd_net *nn, struct nfs4_cpntf_state *cps) ...@@ -5681,8 +5681,9 @@ _free_cpntf_state_locked(struct nfsd_net *nn, struct nfs4_cpntf_state *cps)
* copy stateid. Look up the copy notify stateid from the * copy stateid. Look up the copy notify stateid from the
* idr structure and take a reference on it. * idr structure and take a reference on it.
*/ */
static __be32 _find_cpntf_state(struct nfsd_net *nn, stateid_t *st, __be32 manage_cpntf_state(struct nfsd_net *nn, stateid_t *st,
struct nfs4_cpntf_state **cps) struct nfs4_client *clp,
struct nfs4_cpntf_state **cps)
{ {
copy_stateid_t *cps_t; copy_stateid_t *cps_t;
struct nfs4_cpntf_state *state = NULL; struct nfs4_cpntf_state *state = NULL;
...@@ -5696,12 +5697,16 @@ static __be32 _find_cpntf_state(struct nfsd_net *nn, stateid_t *st, ...@@ -5696,12 +5697,16 @@ static __be32 _find_cpntf_state(struct nfsd_net *nn, stateid_t *st,
cp_stateid); cp_stateid);
if (state->cp_stateid.sc_type != NFS4_COPYNOTIFY_STID) if (state->cp_stateid.sc_type != NFS4_COPYNOTIFY_STID)
return nfserr_bad_stateid; return nfserr_bad_stateid;
refcount_inc(&state->cp_stateid.sc_count); if (!clp)
refcount_inc(&state->cp_stateid.sc_count);
else
_free_cpntf_state_locked(nn, state);
} }
spin_unlock(&nn->s2s_cp_lock); spin_unlock(&nn->s2s_cp_lock);
if (!state) if (!state)
return nfserr_bad_stateid; return nfserr_bad_stateid;
*cps = state; if (!clp && state)
*cps = state;
return 0; return 0;
} }
...@@ -5712,7 +5717,7 @@ static __be32 find_cpntf_state(struct nfsd_net *nn, stateid_t *st, ...@@ -5712,7 +5717,7 @@ static __be32 find_cpntf_state(struct nfsd_net *nn, stateid_t *st,
struct nfs4_cpntf_state *cps = NULL; struct nfs4_cpntf_state *cps = NULL;
struct nfsd4_compound_state cstate; struct nfsd4_compound_state cstate;
status = _find_cpntf_state(nn, st, &cps); status = manage_cpntf_state(nn, st, NULL, &cps);
if (status) if (status)
return status; return status;
......
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
#define NFSDDBG_FACILITY NFSDDBG_SVC #define NFSDDBG_FACILITY NFSDDBG_SVC
bool inter_copy_offload_enable;
EXPORT_SYMBOL_GPL(inter_copy_offload_enable);
module_param(inter_copy_offload_enable, bool, 0644);
MODULE_PARM_DESC(inter_copy_offload_enable,
"Enable inter server to server copy offload. Default: false");
extern struct svc_program nfsd_program; extern struct svc_program nfsd_program;
static int nfsd(void *vrqstp); static int nfsd(void *vrqstp);
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
......
...@@ -680,6 +680,9 @@ extern struct nfsd4_copy * ...@@ -680,6 +680,9 @@ extern struct nfsd4_copy *
find_async_copy(struct nfs4_client *clp, stateid_t *staetid); find_async_copy(struct nfs4_client *clp, stateid_t *staetid);
extern void nfs4_put_cpntf_state(struct nfsd_net *nn, extern void nfs4_put_cpntf_state(struct nfsd_net *nn,
struct nfs4_cpntf_state *cps); struct nfs4_cpntf_state *cps);
extern __be32 manage_cpntf_state(struct nfsd_net *nn, stateid_t *st,
struct nfs4_client *clp,
struct nfs4_cpntf_state **cps);
static inline void get_nfs4_file(struct nfs4_file *fi) static inline void get_nfs4_file(struct nfs4_file *fi)
{ {
refcount_inc(&fi->fi_ref); refcount_inc(&fi->fi_ref);
......
...@@ -549,7 +549,12 @@ struct nfsd4_copy { ...@@ -549,7 +549,12 @@ struct nfsd4_copy {
struct task_struct *copy_task; struct task_struct *copy_task;
refcount_t refcount; refcount_t refcount;
bool stopped; bool stopped;
struct vfsmount *ss_mnt;
struct nfs_fh c_fh;
nfs4_stateid stateid;
}; };
extern bool inter_copy_offload_enable;
struct nfsd4_seek { struct nfsd4_seek {
/* request */ /* request */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment