aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/nfs4proc.c62
-rw-r--r--include/linux/nfs_xdr.h3
2 files changed, 17 insertions, 48 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0f0b6076de62..b0c01b23422d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -73,9 +73,6 @@ static int _nfs4_proc_open(struct nfs4_opendata *data);
73static int _nfs4_recover_proc_open(struct nfs4_opendata *data); 73static int _nfs4_recover_proc_open(struct nfs4_opendata *data);
74static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); 74static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *);
75static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *); 75static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *);
76static int _nfs4_proc_lookup(struct rpc_clnt *client, struct inode *dir,
77 const struct qstr *name, struct nfs_fh *fhandle,
78 struct nfs_fattr *fattr);
79static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr); 76static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr);
80static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, 77static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
81 struct nfs_fattr *fattr, struct iattr *sattr, 78 struct nfs_fattr *fattr, struct iattr *sattr,
@@ -2408,14 +2405,15 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
2408 return status; 2405 return status;
2409} 2406}
2410 2407
2411static int _nfs4_proc_lookupfh(struct rpc_clnt *clnt, struct nfs_server *server, 2408static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
2412 const struct nfs_fh *dirfh, const struct qstr *name, 2409 const struct qstr *name, struct nfs_fh *fhandle,
2413 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 2410 struct nfs_fattr *fattr)
2414{ 2411{
2412 struct nfs_server *server = NFS_SERVER(dir);
2415 int status; 2413 int status;
2416 struct nfs4_lookup_arg args = { 2414 struct nfs4_lookup_arg args = {
2417 .bitmask = server->attr_bitmask, 2415 .bitmask = server->attr_bitmask,
2418 .dir_fh = dirfh, 2416 .dir_fh = NFS_FH(dir),
2419 .name = name, 2417 .name = name,
2420 }; 2418 };
2421 struct nfs4_lookup_res res = { 2419 struct nfs4_lookup_res res = {
@@ -2431,40 +2429,8 @@ static int _nfs4_proc_lookupfh(struct rpc_clnt *clnt, struct nfs_server *server,
2431 2429
2432 nfs_fattr_init(fattr); 2430 nfs_fattr_init(fattr);
2433 2431
2434 dprintk("NFS call lookupfh %s\n", name->name);
2435 status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, &res.seq_res, 0);
2436 dprintk("NFS reply lookupfh: %d\n", status);
2437 return status;
2438}
2439
2440static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh,
2441 struct qstr *name, struct nfs_fh *fhandle,
2442 struct nfs_fattr *fattr)
2443{
2444 struct nfs4_exception exception = { };
2445 int err;
2446 do {
2447 err = _nfs4_proc_lookupfh(server->client, server, dirfh, name, fhandle, fattr);
2448 /* FIXME: !!!! */
2449 if (err == -NFS4ERR_MOVED) {
2450 err = -EREMOTE;
2451 break;
2452 }
2453 err = nfs4_handle_exception(server, err, &exception);
2454 } while (exception.retry);
2455 return err;
2456}
2457
2458static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
2459 const struct qstr *name, struct nfs_fh *fhandle,
2460 struct nfs_fattr *fattr)
2461{
2462 int status;
2463
2464 dprintk("NFS call lookup %s\n", name->name); 2432 dprintk("NFS call lookup %s\n", name->name);
2465 status = _nfs4_proc_lookupfh(clnt, NFS_SERVER(dir), NFS_FH(dir), name, fhandle, fattr); 2433 status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, &res.seq_res, 0);
2466 if (status == -NFS4ERR_MOVED)
2467 status = nfs4_get_referral(dir, name, fattr, fhandle);
2468 dprintk("NFS reply lookup: %d\n", status); 2434 dprintk("NFS reply lookup: %d\n", status);
2469 return status; 2435 return status;
2470} 2436}
@@ -2485,11 +2451,18 @@ static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qst
2485 struct nfs4_exception exception = { }; 2451 struct nfs4_exception exception = { };
2486 int err; 2452 int err;
2487 do { 2453 do {
2488 err = nfs4_handle_exception(NFS_SERVER(dir), 2454 int status;
2489 _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr), 2455
2490 &exception); 2456 status = _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr);
2491 if (err == -EPERM) 2457 switch (status) {
2458 case -NFS4ERR_MOVED:
2459 err = nfs4_get_referral(dir, name, fattr, fhandle);
2460 break;
2461 case -NFS4ERR_WRONGSEC:
2492 nfs_fixup_secinfo_attributes(fattr, fhandle); 2462 nfs_fixup_secinfo_attributes(fattr, fhandle);
2463 }
2464 err = nfs4_handle_exception(NFS_SERVER(dir),
2465 status, &exception);
2493 } while (exception.retry); 2466 } while (exception.retry);
2494 return err; 2467 return err;
2495} 2468}
@@ -6270,7 +6243,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
6270 .getroot = nfs4_proc_get_root, 6243 .getroot = nfs4_proc_get_root,
6271 .getattr = nfs4_proc_getattr, 6244 .getattr = nfs4_proc_getattr,
6272 .setattr = nfs4_proc_setattr, 6245 .setattr = nfs4_proc_setattr,
6273 .lookupfh = nfs4_proc_lookupfh,
6274 .lookup = nfs4_proc_lookup, 6246 .lookup = nfs4_proc_lookup,
6275 .access = nfs4_proc_access, 6247 .access = nfs4_proc_access,
6276 .readlink = nfs4_proc_readlink, 6248 .readlink = nfs4_proc_readlink,
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index abd615d74a29..1e31e1c8655b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1197,9 +1197,6 @@ struct nfs_rpc_ops {
1197 1197
1198 int (*getroot) (struct nfs_server *, struct nfs_fh *, 1198 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1199 struct nfs_fsinfo *); 1199 struct nfs_fsinfo *);
1200 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1201 struct qstr *, struct nfs_fh *,
1202 struct nfs_fattr *);
1203 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1200 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1204 struct nfs_fattr *); 1201 struct nfs_fattr *);
1205 int (*setattr) (struct dentry *, struct nfs_fattr *, 1202 int (*setattr) (struct dentry *, struct nfs_fattr *,