@@ -39,6 +39,15 @@ static int nfs42_set_rw_stateid(nfs4_stateid *dst, struct file *file,
return ret;
}
+static void nfs42_set_open_stateid(nfs4_stateid *dst, struct file *file)
+{
+ struct nfs_open_context *open;
+
+ open = get_nfs_open_context(nfs_file_open_context(file));
+ nfs4_copy_open_stateid(dst, open->state);
+ put_nfs_open_context(open);
+}
+
static void nfs42_set_netaddr(struct file *file_out,
struct nfs42_netaddr *naddr)
{
@@ -272,10 +281,7 @@ static int nfs42_proc_copy_notify(struct file *src, struct file *dst,
args->cna_src_fh = NFS_FH(file_inode(src)),
args->cna_dst.nl4_type = NL4_NETADDR;
nfs42_set_netaddr(src, &args->cna_dst.u.nl4_addr);
-
- status = nfs42_set_rw_stateid(&args->cna_src_stateid, src, FMODE_READ);
- if (status)
- return status;
+ nfs42_set_open_stateid(&args->cna_src_stateid, src);
msg.rpc_argp = args;
status = nfs4_call_sync(src_server->client, src_server, &msg,
@@ -447,7 +447,7 @@ extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
extern int nfs4_select_rw_stateid(nfs4_stateid *, struct nfs4_state *,
fmode_t, const struct nfs_lockowner *);
-
+extern void nfs4_copy_open_stateid(nfs4_stateid *, struct nfs4_state *);
extern struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter, gfp_t gfp_mask);
extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task);
extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid);
@@ -967,7 +967,7 @@ out:
return ret;
}
-static void nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)
+void nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)
{
const nfs4_stateid *src;
int seq;