|
@@ -271,6 +271,33 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
|
|
spin_unlock(&clp->cl_lock);
|
|
spin_unlock(&clp->cl_lock);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#if defined(CONFIG_NFS_V4_1)
|
|
|
|
+
|
|
|
|
+int _nfs4_call_sync_session(struct nfs_server *server,
|
|
|
|
+ struct rpc_message *msg,
|
|
|
|
+ struct nfs4_sequence_args *args,
|
|
|
|
+ struct nfs4_sequence_res *res,
|
|
|
|
+ int cache_reply)
|
|
|
|
+{
|
|
|
|
+ /* in preparation for setting up the sequence op */
|
|
|
|
+ return rpc_call_sync(server->client, msg, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#endif /* CONFIG_NFS_V4_1 */
|
|
|
|
+
|
|
|
|
+int _nfs4_call_sync(struct nfs_server *server,
|
|
|
|
+ struct rpc_message *msg,
|
|
|
|
+ struct nfs4_sequence_args *args,
|
|
|
|
+ struct nfs4_sequence_res *res,
|
|
|
|
+ int cache_reply)
|
|
|
|
+{
|
|
|
|
+ return rpc_call_sync(server->client, msg, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define nfs4_call_sync(server, msg, args, res, cache_reply) \
|
|
|
|
+ (server)->nfs_client->cl_call_sync((server), (msg), &(args)->seq_args, \
|
|
|
|
+ &(res)->seq_res, (cache_reply))
|
|
|
|
+
|
|
static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
|
|
static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
|
|
{
|
|
{
|
|
struct nfs_inode *nfsi = NFS_I(dir);
|
|
struct nfs_inode *nfsi = NFS_I(dir);
|
|
@@ -1269,7 +1296,7 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
|
|
} else
|
|
} else
|
|
memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
|
|
memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
|
|
|
|
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &arg, &res, 1);
|
|
if (status == 0 && state != NULL)
|
|
if (status == 0 && state != NULL)
|
|
renew_lease(server, timestamp);
|
|
renew_lease(server, timestamp);
|
|
return status;
|
|
return status;
|
|
@@ -1595,7 +1622,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
|
|
};
|
|
};
|
|
int status;
|
|
int status;
|
|
|
|
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
if (status == 0) {
|
|
if (status == 0) {
|
|
memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask));
|
|
memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask));
|
|
if (res.attr_bitmask[0] & FATTR4_WORD0_ACL)
|
|
if (res.attr_bitmask[0] & FATTR4_WORD0_ACL)
|
|
@@ -1609,6 +1636,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
|
|
server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;
|
|
server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;
|
|
server->acl_bitmask = res.acl_bitmask;
|
|
server->acl_bitmask = res.acl_bitmask;
|
|
}
|
|
}
|
|
|
|
+
|
|
return status;
|
|
return status;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1641,7 +1669,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
.rpc_resp = &res,
|
|
.rpc_resp = &res,
|
|
};
|
|
};
|
|
nfs_fattr_init(info->fattr);
|
|
nfs_fattr_init(info->fattr);
|
|
- return rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ return nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
@@ -1731,7 +1759,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
};
|
|
};
|
|
|
|
|
|
nfs_fattr_init(fattr);
|
|
nfs_fattr_init(fattr);
|
|
- return rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ return nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
|
|
static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
|
|
@@ -1815,7 +1843,7 @@ static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *d
|
|
nfs_fattr_init(fattr);
|
|
nfs_fattr_init(fattr);
|
|
|
|
|
|
dprintk("NFS call lookupfh %s\n", name->name);
|
|
dprintk("NFS call lookupfh %s\n", name->name);
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
dprintk("NFS reply lookupfh: %d\n", status);
|
|
dprintk("NFS reply lookupfh: %d\n", status);
|
|
return status;
|
|
return status;
|
|
}
|
|
}
|
|
@@ -1901,7 +1929,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
|
|
args.access |= NFS4_ACCESS_EXECUTE;
|
|
args.access |= NFS4_ACCESS_EXECUTE;
|
|
}
|
|
}
|
|
nfs_fattr_init(&fattr);
|
|
nfs_fattr_init(&fattr);
|
|
- status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
if (!status) {
|
|
if (!status) {
|
|
entry->mask = 0;
|
|
entry->mask = 0;
|
|
if (res.access & NFS4_ACCESS_READ)
|
|
if (res.access & NFS4_ACCESS_READ)
|
|
@@ -1967,7 +1995,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page,
|
|
.rpc_resp = &res,
|
|
.rpc_resp = &res,
|
|
};
|
|
};
|
|
|
|
|
|
- return rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
|
|
|
|
|
|
+ return nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static int nfs4_proc_readlink(struct inode *inode, struct page *page,
|
|
static int nfs4_proc_readlink(struct inode *inode, struct page *page,
|
|
@@ -2061,7 +2089,7 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
|
|
int status;
|
|
int status;
|
|
|
|
|
|
nfs_fattr_init(&res.dir_attr);
|
|
nfs_fattr_init(&res.dir_attr);
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &args, &res, 1);
|
|
if (status == 0) {
|
|
if (status == 0) {
|
|
update_changeattr(dir, &res.cinfo);
|
|
update_changeattr(dir, &res.cinfo);
|
|
nfs_post_op_update_inode(dir, &res.dir_attr);
|
|
nfs_post_op_update_inode(dir, &res.dir_attr);
|
|
@@ -2129,7 +2157,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
|
|
|
|
|
|
nfs_fattr_init(res.old_fattr);
|
|
nfs_fattr_init(res.old_fattr);
|
|
nfs_fattr_init(res.new_fattr);
|
|
nfs_fattr_init(res.new_fattr);
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &arg, &res, 1);
|
|
|
|
|
|
if (!status) {
|
|
if (!status) {
|
|
update_changeattr(old_dir, &res.old_cinfo);
|
|
update_changeattr(old_dir, &res.old_cinfo);
|
|
@@ -2178,7 +2206,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *
|
|
|
|
|
|
nfs_fattr_init(res.fattr);
|
|
nfs_fattr_init(res.fattr);
|
|
nfs_fattr_init(res.dir_attr);
|
|
nfs_fattr_init(res.dir_attr);
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &arg, &res, 1);
|
|
if (!status) {
|
|
if (!status) {
|
|
update_changeattr(dir, &res.cinfo);
|
|
update_changeattr(dir, &res.cinfo);
|
|
nfs_post_op_update_inode(dir, res.dir_attr);
|
|
nfs_post_op_update_inode(dir, res.dir_attr);
|
|
@@ -2239,7 +2267,8 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
|
|
|
|
|
|
static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
|
|
static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
|
|
{
|
|
{
|
|
- int status = rpc_call_sync(NFS_CLIENT(dir), &data->msg, 0);
|
|
|
|
|
|
+ int status = nfs4_call_sync(NFS_SERVER(dir), &data->msg,
|
|
|
|
+ &data->arg, &data->res, 1);
|
|
if (status == 0) {
|
|
if (status == 0) {
|
|
update_changeattr(dir, &data->res.dir_cinfo);
|
|
update_changeattr(dir, &data->res.dir_cinfo);
|
|
nfs_post_op_update_inode(dir, data->res.dir_fattr);
|
|
nfs_post_op_update_inode(dir, data->res.dir_fattr);
|
|
@@ -2348,7 +2377,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
|
|
(unsigned long long)cookie);
|
|
(unsigned long long)cookie);
|
|
nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
|
|
nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
|
|
res.pgbase = args.pgbase;
|
|
res.pgbase = args.pgbase;
|
|
- status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(NFS_SERVER(dir), &msg, &args, &res, 0);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
|
|
memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
|
|
|
|
|
|
@@ -2436,7 +2465,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
};
|
|
};
|
|
|
|
|
|
nfs_fattr_init(fsstat->fattr);
|
|
nfs_fattr_init(fsstat->fattr);
|
|
- return rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ return nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat)
|
|
static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat)
|
|
@@ -2467,7 +2496,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
.rpc_resp = &res,
|
|
.rpc_resp = &res,
|
|
};
|
|
};
|
|
|
|
|
|
- return rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ return nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
|
|
static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
|
|
@@ -2512,7 +2541,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
|
|
}
|
|
}
|
|
|
|
|
|
nfs_fattr_init(pathconf->fattr);
|
|
nfs_fattr_init(pathconf->fattr);
|
|
- return rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ return nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
@@ -2781,7 +2810,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
|
|
resp_buf = buf;
|
|
resp_buf = buf;
|
|
buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);
|
|
buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);
|
|
}
|
|
}
|
|
- ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
|
|
|
|
|
|
+ ret = nfs4_call_sync(NFS_SERVER(inode), &msg, &args, &res, 0);
|
|
if (ret)
|
|
if (ret)
|
|
goto out_free;
|
|
goto out_free;
|
|
if (res.acl_len > args.acl_len)
|
|
if (res.acl_len > args.acl_len)
|
|
@@ -2854,7 +2883,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
|
|
return -EOPNOTSUPP;
|
|
return -EOPNOTSUPP;
|
|
nfs_inode_return_delegation(inode);
|
|
nfs_inode_return_delegation(inode);
|
|
buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
|
|
buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
|
|
- ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
|
|
|
|
|
|
+ ret = nfs4_call_sync(server, &msg, &arg, &res, 1);
|
|
nfs_access_zap_cache(inode);
|
|
nfs_access_zap_cache(inode);
|
|
nfs_zap_acl_cache(inode);
|
|
nfs_zap_acl_cache(inode);
|
|
return ret;
|
|
return ret;
|
|
@@ -3143,7 +3172,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
|
|
goto out;
|
|
goto out;
|
|
lsp = request->fl_u.nfs4_fl.owner;
|
|
lsp = request->fl_u.nfs4_fl.owner;
|
|
arg.lock_owner.id = lsp->ls_id.id;
|
|
arg.lock_owner.id = lsp->ls_id.id;
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &arg, &res, 1);
|
|
switch (status) {
|
|
switch (status) {
|
|
case 0:
|
|
case 0:
|
|
request->fl_type = F_UNLCK;
|
|
request->fl_type = F_UNLCK;
|
|
@@ -3736,7 +3765,7 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
|
|
nfs_fattr_init(&fs_locations->fattr);
|
|
nfs_fattr_init(&fs_locations->fattr);
|
|
fs_locations->server = server;
|
|
fs_locations->server = server;
|
|
fs_locations->nlocations = 0;
|
|
fs_locations->nlocations = 0;
|
|
- status = rpc_call_sync(server->client, &msg, 0);
|
|
|
|
|
|
+ status = nfs4_call_sync(server, &msg, &args, &res, 0);
|
|
nfs_fixup_referral_attributes(&fs_locations->fattr);
|
|
nfs_fixup_referral_attributes(&fs_locations->fattr);
|
|
dprintk("%s: returned status = %d\n", __func__, status);
|
|
dprintk("%s: returned status = %d\n", __func__, status);
|
|
return status;
|
|
return status;
|