diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 218 |
1 files changed, 113 insertions, 105 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b14145b7b87f..47c7e6e3910d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -55,7 +55,7 @@ | |||
55 | 55 | ||
56 | #define NFSDBG_FACILITY NFSDBG_PROC | 56 | #define NFSDBG_FACILITY NFSDBG_PROC |
57 | 57 | ||
58 | #define NFS4_POLL_RETRY_MIN (1*HZ) | 58 | #define NFS4_POLL_RETRY_MIN (HZ/10) |
59 | #define NFS4_POLL_RETRY_MAX (15*HZ) | 59 | #define NFS4_POLL_RETRY_MAX (15*HZ) |
60 | 60 | ||
61 | struct nfs4_opendata; | 61 | struct nfs4_opendata; |
@@ -64,7 +64,7 @@ static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinf | |||
64 | static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *); | 64 | static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *); |
65 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry); | 65 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry); |
66 | static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception); | 66 | static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception); |
67 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs4_client *clp); | 67 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp); |
68 | 68 | ||
69 | /* Prevent leaks of NFSv4 errors into userland */ | 69 | /* Prevent leaks of NFSv4 errors into userland */ |
70 | int nfs4_map_errors(int err) | 70 | int nfs4_map_errors(int err) |
@@ -195,7 +195,7 @@ static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, | |||
195 | 195 | ||
196 | static void renew_lease(const struct nfs_server *server, unsigned long timestamp) | 196 | static void renew_lease(const struct nfs_server *server, unsigned long timestamp) |
197 | { | 197 | { |
198 | struct nfs4_client *clp = server->nfs4_state; | 198 | struct nfs_client *clp = server->nfs_client; |
199 | spin_lock(&clp->cl_lock); | 199 | spin_lock(&clp->cl_lock); |
200 | if (time_before(clp->cl_last_renewal,timestamp)) | 200 | if (time_before(clp->cl_last_renewal,timestamp)) |
201 | clp->cl_last_renewal = timestamp; | 201 | clp->cl_last_renewal = timestamp; |
@@ -252,7 +252,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, | |||
252 | atomic_inc(&sp->so_count); | 252 | atomic_inc(&sp->so_count); |
253 | p->o_arg.fh = NFS_FH(dir); | 253 | p->o_arg.fh = NFS_FH(dir); |
254 | p->o_arg.open_flags = flags, | 254 | p->o_arg.open_flags = flags, |
255 | p->o_arg.clientid = server->nfs4_state->cl_clientid; | 255 | p->o_arg.clientid = server->nfs_client->cl_clientid; |
256 | p->o_arg.id = sp->so_id; | 256 | p->o_arg.id = sp->so_id; |
257 | p->o_arg.name = &dentry->d_name; | 257 | p->o_arg.name = &dentry->d_name; |
258 | p->o_arg.server = server; | 258 | p->o_arg.server = server; |
@@ -550,7 +550,7 @@ int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) | |||
550 | case -NFS4ERR_STALE_STATEID: | 550 | case -NFS4ERR_STALE_STATEID: |
551 | case -NFS4ERR_EXPIRED: | 551 | case -NFS4ERR_EXPIRED: |
552 | /* Don't recall a delegation if it was lost */ | 552 | /* Don't recall a delegation if it was lost */ |
553 | nfs4_schedule_state_recovery(server->nfs4_state); | 553 | nfs4_schedule_state_recovery(server->nfs_client); |
554 | return err; | 554 | return err; |
555 | } | 555 | } |
556 | err = nfs4_handle_exception(server, err, &exception); | 556 | err = nfs4_handle_exception(server, err, &exception); |
@@ -758,7 +758,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
758 | } | 758 | } |
759 | nfs_confirm_seqid(&data->owner->so_seqid, 0); | 759 | nfs_confirm_seqid(&data->owner->so_seqid, 0); |
760 | if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) | 760 | if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) |
761 | return server->rpc_ops->getattr(server, &o_res->fh, o_res->f_attr); | 761 | return server->nfs_client->rpc_ops->getattr(server, &o_res->fh, o_res->f_attr); |
762 | return 0; | 762 | return 0; |
763 | } | 763 | } |
764 | 764 | ||
@@ -792,11 +792,18 @@ out: | |||
792 | 792 | ||
793 | int nfs4_recover_expired_lease(struct nfs_server *server) | 793 | int nfs4_recover_expired_lease(struct nfs_server *server) |
794 | { | 794 | { |
795 | struct nfs4_client *clp = server->nfs4_state; | 795 | struct nfs_client *clp = server->nfs_client; |
796 | int ret; | ||
796 | 797 | ||
797 | if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) | 798 | for (;;) { |
799 | ret = nfs4_wait_clnt_recover(server->client, clp); | ||
800 | if (ret != 0) | ||
801 | return ret; | ||
802 | if (!test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) | ||
803 | break; | ||
798 | nfs4_schedule_state_recovery(clp); | 804 | nfs4_schedule_state_recovery(clp); |
799 | return nfs4_wait_clnt_recover(server->client, clp); | 805 | } |
806 | return 0; | ||
800 | } | 807 | } |
801 | 808 | ||
802 | /* | 809 | /* |
@@ -867,7 +874,7 @@ static int _nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred | |||
867 | { | 874 | { |
868 | struct nfs_delegation *delegation; | 875 | struct nfs_delegation *delegation; |
869 | struct nfs_server *server = NFS_SERVER(inode); | 876 | struct nfs_server *server = NFS_SERVER(inode); |
870 | struct nfs4_client *clp = server->nfs4_state; | 877 | struct nfs_client *clp = server->nfs_client; |
871 | struct nfs_inode *nfsi = NFS_I(inode); | 878 | struct nfs_inode *nfsi = NFS_I(inode); |
872 | struct nfs4_state_owner *sp = NULL; | 879 | struct nfs4_state_owner *sp = NULL; |
873 | struct nfs4_state *state = NULL; | 880 | struct nfs4_state *state = NULL; |
@@ -953,7 +960,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st | |||
953 | struct nfs4_state_owner *sp; | 960 | struct nfs4_state_owner *sp; |
954 | struct nfs4_state *state = NULL; | 961 | struct nfs4_state *state = NULL; |
955 | struct nfs_server *server = NFS_SERVER(dir); | 962 | struct nfs_server *server = NFS_SERVER(dir); |
956 | struct nfs4_client *clp = server->nfs4_state; | 963 | struct nfs_client *clp = server->nfs_client; |
957 | struct nfs4_opendata *opendata; | 964 | struct nfs4_opendata *opendata; |
958 | int status; | 965 | int status; |
959 | 966 | ||
@@ -1133,7 +1140,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
1133 | break; | 1140 | break; |
1134 | case -NFS4ERR_STALE_STATEID: | 1141 | case -NFS4ERR_STALE_STATEID: |
1135 | case -NFS4ERR_EXPIRED: | 1142 | case -NFS4ERR_EXPIRED: |
1136 | nfs4_schedule_state_recovery(server->nfs4_state); | 1143 | nfs4_schedule_state_recovery(server->nfs_client); |
1137 | break; | 1144 | break; |
1138 | default: | 1145 | default: |
1139 | if (nfs4_async_handle_error(task, server) == -EAGAIN) { | 1146 | if (nfs4_async_handle_error(task, server) == -EAGAIN) { |
@@ -1268,7 +1275,7 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
1268 | BUG_ON(nd->intent.open.flags & O_CREAT); | 1275 | BUG_ON(nd->intent.open.flags & O_CREAT); |
1269 | } | 1276 | } |
1270 | 1277 | ||
1271 | cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0); | 1278 | cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); |
1272 | if (IS_ERR(cred)) | 1279 | if (IS_ERR(cred)) |
1273 | return (struct dentry *)cred; | 1280 | return (struct dentry *)cred; |
1274 | state = nfs4_do_open(dir, dentry, nd->intent.open.flags, &attr, cred); | 1281 | state = nfs4_do_open(dir, dentry, nd->intent.open.flags, &attr, cred); |
@@ -1291,7 +1298,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st | |||
1291 | struct rpc_cred *cred; | 1298 | struct rpc_cred *cred; |
1292 | struct nfs4_state *state; | 1299 | struct nfs4_state *state; |
1293 | 1300 | ||
1294 | cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0); | 1301 | cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); |
1295 | if (IS_ERR(cred)) | 1302 | if (IS_ERR(cred)) |
1296 | return PTR_ERR(cred); | 1303 | return PTR_ERR(cred); |
1297 | state = nfs4_open_delegated(dentry->d_inode, openflags, cred); | 1304 | state = nfs4_open_delegated(dentry->d_inode, openflags, cred); |
@@ -1393,70 +1400,19 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
1393 | return err; | 1400 | return err; |
1394 | } | 1401 | } |
1395 | 1402 | ||
1403 | /* | ||
1404 | * get the file handle for the "/" directory on the server | ||
1405 | */ | ||
1396 | static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | 1406 | static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, |
1397 | struct nfs_fsinfo *info) | 1407 | struct nfs_fsinfo *info) |
1398 | { | 1408 | { |
1399 | struct nfs_fattr * fattr = info->fattr; | ||
1400 | unsigned char * p; | ||
1401 | struct qstr q; | ||
1402 | struct nfs4_lookup_arg args = { | ||
1403 | .dir_fh = fhandle, | ||
1404 | .name = &q, | ||
1405 | .bitmask = nfs4_fattr_bitmap, | ||
1406 | }; | ||
1407 | struct nfs4_lookup_res res = { | ||
1408 | .server = server, | ||
1409 | .fattr = fattr, | ||
1410 | .fh = fhandle, | ||
1411 | }; | ||
1412 | struct rpc_message msg = { | ||
1413 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP], | ||
1414 | .rpc_argp = &args, | ||
1415 | .rpc_resp = &res, | ||
1416 | }; | ||
1417 | int status; | 1409 | int status; |
1418 | 1410 | ||
1419 | /* | ||
1420 | * Now we do a separate LOOKUP for each component of the mount path. | ||
1421 | * The LOOKUPs are done separately so that we can conveniently | ||
1422 | * catch an ERR_WRONGSEC if it occurs along the way... | ||
1423 | */ | ||
1424 | status = nfs4_lookup_root(server, fhandle, info); | 1411 | status = nfs4_lookup_root(server, fhandle, info); |
1425 | if (status) | ||
1426 | goto out; | ||
1427 | |||
1428 | p = server->mnt_path; | ||
1429 | for (;;) { | ||
1430 | struct nfs4_exception exception = { }; | ||
1431 | |||
1432 | while (*p == '/') | ||
1433 | p++; | ||
1434 | if (!*p) | ||
1435 | break; | ||
1436 | q.name = p; | ||
1437 | while (*p && (*p != '/')) | ||
1438 | p++; | ||
1439 | q.len = p - q.name; | ||
1440 | |||
1441 | do { | ||
1442 | nfs_fattr_init(fattr); | ||
1443 | status = nfs4_handle_exception(server, | ||
1444 | rpc_call_sync(server->client, &msg, 0), | ||
1445 | &exception); | ||
1446 | } while (exception.retry); | ||
1447 | if (status == 0) | ||
1448 | continue; | ||
1449 | if (status == -ENOENT) { | ||
1450 | printk(KERN_NOTICE "NFS: mount path %s does not exist!\n", server->mnt_path); | ||
1451 | printk(KERN_NOTICE "NFS: suggestion: try mounting '/' instead.\n"); | ||
1452 | } | ||
1453 | break; | ||
1454 | } | ||
1455 | if (status == 0) | 1412 | if (status == 0) |
1456 | status = nfs4_server_capabilities(server, fhandle); | 1413 | status = nfs4_server_capabilities(server, fhandle); |
1457 | if (status == 0) | 1414 | if (status == 0) |
1458 | status = nfs4_do_fsinfo(server, fhandle, info); | 1415 | status = nfs4_do_fsinfo(server, fhandle, info); |
1459 | out: | ||
1460 | return nfs4_map_errors(status); | 1416 | return nfs4_map_errors(status); |
1461 | } | 1417 | } |
1462 | 1418 | ||
@@ -1565,7 +1521,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
1565 | 1521 | ||
1566 | nfs_fattr_init(fattr); | 1522 | nfs_fattr_init(fattr); |
1567 | 1523 | ||
1568 | cred = rpcauth_lookupcred(NFS_SERVER(inode)->client->cl_auth, 0); | 1524 | cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); |
1569 | if (IS_ERR(cred)) | 1525 | if (IS_ERR(cred)) |
1570 | return PTR_ERR(cred); | 1526 | return PTR_ERR(cred); |
1571 | 1527 | ||
@@ -1583,6 +1539,52 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
1583 | return status; | 1539 | return status; |
1584 | } | 1540 | } |
1585 | 1541 | ||
1542 | static int _nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, | ||
1543 | struct qstr *name, struct nfs_fh *fhandle, | ||
1544 | struct nfs_fattr *fattr) | ||
1545 | { | ||
1546 | int status; | ||
1547 | struct nfs4_lookup_arg args = { | ||
1548 | .bitmask = server->attr_bitmask, | ||
1549 | .dir_fh = dirfh, | ||
1550 | .name = name, | ||
1551 | }; | ||
1552 | struct nfs4_lookup_res res = { | ||
1553 | .server = server, | ||
1554 | .fattr = fattr, | ||
1555 | .fh = fhandle, | ||
1556 | }; | ||
1557 | struct rpc_message msg = { | ||
1558 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP], | ||
1559 | .rpc_argp = &args, | ||
1560 | .rpc_resp = &res, | ||
1561 | }; | ||
1562 | |||
1563 | nfs_fattr_init(fattr); | ||
1564 | |||
1565 | dprintk("NFS call lookupfh %s\n", name->name); | ||
1566 | status = rpc_call_sync(server->client, &msg, 0); | ||
1567 | dprintk("NFS reply lookupfh: %d\n", status); | ||
1568 | if (status == -NFS4ERR_MOVED) | ||
1569 | status = -EREMOTE; | ||
1570 | return status; | ||
1571 | } | ||
1572 | |||
1573 | static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, | ||
1574 | struct qstr *name, struct nfs_fh *fhandle, | ||
1575 | struct nfs_fattr *fattr) | ||
1576 | { | ||
1577 | struct nfs4_exception exception = { }; | ||
1578 | int err; | ||
1579 | do { | ||
1580 | err = nfs4_handle_exception(server, | ||
1581 | _nfs4_proc_lookupfh(server, dirfh, name, | ||
1582 | fhandle, fattr), | ||
1583 | &exception); | ||
1584 | } while (exception.retry); | ||
1585 | return err; | ||
1586 | } | ||
1587 | |||
1586 | static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, | 1588 | static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, |
1587 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 1589 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) |
1588 | { | 1590 | { |
@@ -1881,7 +1883,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
1881 | struct rpc_cred *cred; | 1883 | struct rpc_cred *cred; |
1882 | int status = 0; | 1884 | int status = 0; |
1883 | 1885 | ||
1884 | cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0); | 1886 | cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); |
1885 | if (IS_ERR(cred)) { | 1887 | if (IS_ERR(cred)) { |
1886 | status = PTR_ERR(cred); | 1888 | status = PTR_ERR(cred); |
1887 | goto out; | 1889 | goto out; |
@@ -2089,24 +2091,24 @@ static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *n | |||
2089 | return err; | 2091 | return err; |
2090 | } | 2092 | } |
2091 | 2093 | ||
2092 | static int _nfs4_proc_symlink(struct inode *dir, struct qstr *name, | 2094 | static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, |
2093 | struct qstr *path, struct iattr *sattr, struct nfs_fh *fhandle, | 2095 | struct page *page, unsigned int len, struct iattr *sattr) |
2094 | struct nfs_fattr *fattr) | ||
2095 | { | 2096 | { |
2096 | struct nfs_server *server = NFS_SERVER(dir); | 2097 | struct nfs_server *server = NFS_SERVER(dir); |
2097 | struct nfs_fattr dir_fattr; | 2098 | struct nfs_fh fhandle; |
2099 | struct nfs_fattr fattr, dir_fattr; | ||
2098 | struct nfs4_create_arg arg = { | 2100 | struct nfs4_create_arg arg = { |
2099 | .dir_fh = NFS_FH(dir), | 2101 | .dir_fh = NFS_FH(dir), |
2100 | .server = server, | 2102 | .server = server, |
2101 | .name = name, | 2103 | .name = &dentry->d_name, |
2102 | .attrs = sattr, | 2104 | .attrs = sattr, |
2103 | .ftype = NF4LNK, | 2105 | .ftype = NF4LNK, |
2104 | .bitmask = server->attr_bitmask, | 2106 | .bitmask = server->attr_bitmask, |
2105 | }; | 2107 | }; |
2106 | struct nfs4_create_res res = { | 2108 | struct nfs4_create_res res = { |
2107 | .server = server, | 2109 | .server = server, |
2108 | .fh = fhandle, | 2110 | .fh = &fhandle, |
2109 | .fattr = fattr, | 2111 | .fattr = &fattr, |
2110 | .dir_fattr = &dir_fattr, | 2112 | .dir_fattr = &dir_fattr, |
2111 | }; | 2113 | }; |
2112 | struct rpc_message msg = { | 2114 | struct rpc_message msg = { |
@@ -2116,29 +2118,32 @@ static int _nfs4_proc_symlink(struct inode *dir, struct qstr *name, | |||
2116 | }; | 2118 | }; |
2117 | int status; | 2119 | int status; |
2118 | 2120 | ||
2119 | if (path->len > NFS4_MAXPATHLEN) | 2121 | if (len > NFS4_MAXPATHLEN) |
2120 | return -ENAMETOOLONG; | 2122 | return -ENAMETOOLONG; |
2121 | arg.u.symlink = path; | 2123 | |
2122 | nfs_fattr_init(fattr); | 2124 | arg.u.symlink.pages = &page; |
2125 | arg.u.symlink.len = len; | ||
2126 | nfs_fattr_init(&fattr); | ||
2123 | nfs_fattr_init(&dir_fattr); | 2127 | nfs_fattr_init(&dir_fattr); |
2124 | 2128 | ||
2125 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 2129 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
2126 | if (!status) | 2130 | if (!status) { |
2127 | update_changeattr(dir, &res.dir_cinfo); | 2131 | update_changeattr(dir, &res.dir_cinfo); |
2128 | nfs_post_op_update_inode(dir, res.dir_fattr); | 2132 | nfs_post_op_update_inode(dir, res.dir_fattr); |
2133 | status = nfs_instantiate(dentry, &fhandle, &fattr); | ||
2134 | } | ||
2129 | return status; | 2135 | return status; |
2130 | } | 2136 | } |
2131 | 2137 | ||
2132 | static int nfs4_proc_symlink(struct inode *dir, struct qstr *name, | 2138 | static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, |
2133 | struct qstr *path, struct iattr *sattr, struct nfs_fh *fhandle, | 2139 | struct page *page, unsigned int len, struct iattr *sattr) |
2134 | struct nfs_fattr *fattr) | ||
2135 | { | 2140 | { |
2136 | struct nfs4_exception exception = { }; | 2141 | struct nfs4_exception exception = { }; |
2137 | int err; | 2142 | int err; |
2138 | do { | 2143 | do { |
2139 | err = nfs4_handle_exception(NFS_SERVER(dir), | 2144 | err = nfs4_handle_exception(NFS_SERVER(dir), |
2140 | _nfs4_proc_symlink(dir, name, path, sattr, | 2145 | _nfs4_proc_symlink(dir, dentry, page, |
2141 | fhandle, fattr), | 2146 | len, sattr), |
2142 | &exception); | 2147 | &exception); |
2143 | } while (exception.retry); | 2148 | } while (exception.retry); |
2144 | return err; | 2149 | return err; |
@@ -2521,7 +2526,7 @@ static void nfs4_proc_commit_setup(struct nfs_write_data *data, int how) | |||
2521 | */ | 2526 | */ |
2522 | static void nfs4_renew_done(struct rpc_task *task, void *data) | 2527 | static void nfs4_renew_done(struct rpc_task *task, void *data) |
2523 | { | 2528 | { |
2524 | struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; | 2529 | struct nfs_client *clp = (struct nfs_client *)task->tk_msg.rpc_argp; |
2525 | unsigned long timestamp = (unsigned long)data; | 2530 | unsigned long timestamp = (unsigned long)data; |
2526 | 2531 | ||
2527 | if (task->tk_status < 0) { | 2532 | if (task->tk_status < 0) { |
@@ -2543,7 +2548,7 @@ static const struct rpc_call_ops nfs4_renew_ops = { | |||
2543 | .rpc_call_done = nfs4_renew_done, | 2548 | .rpc_call_done = nfs4_renew_done, |
2544 | }; | 2549 | }; |
2545 | 2550 | ||
2546 | int nfs4_proc_async_renew(struct nfs4_client *clp, struct rpc_cred *cred) | 2551 | int nfs4_proc_async_renew(struct nfs_client *clp, struct rpc_cred *cred) |
2547 | { | 2552 | { |
2548 | struct rpc_message msg = { | 2553 | struct rpc_message msg = { |
2549 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 2554 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
@@ -2555,7 +2560,7 @@ int nfs4_proc_async_renew(struct nfs4_client *clp, struct rpc_cred *cred) | |||
2555 | &nfs4_renew_ops, (void *)jiffies); | 2560 | &nfs4_renew_ops, (void *)jiffies); |
2556 | } | 2561 | } |
2557 | 2562 | ||
2558 | int nfs4_proc_renew(struct nfs4_client *clp, struct rpc_cred *cred) | 2563 | int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) |
2559 | { | 2564 | { |
2560 | struct rpc_message msg = { | 2565 | struct rpc_message msg = { |
2561 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], | 2566 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], |
@@ -2770,7 +2775,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl | |||
2770 | return -EOPNOTSUPP; | 2775 | return -EOPNOTSUPP; |
2771 | nfs_inode_return_delegation(inode); | 2776 | nfs_inode_return_delegation(inode); |
2772 | buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); | 2777 | buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); |
2773 | ret = rpc_call_sync(NFS_SERVER(inode)->client, &msg, 0); | 2778 | ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
2774 | if (ret == 0) | 2779 | if (ret == 0) |
2775 | nfs4_write_cached_acl(inode, buf, buflen); | 2780 | nfs4_write_cached_acl(inode, buf, buflen); |
2776 | return ret; | 2781 | return ret; |
@@ -2791,7 +2796,7 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen | |||
2791 | static int | 2796 | static int |
2792 | nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server) | 2797 | nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server) |
2793 | { | 2798 | { |
2794 | struct nfs4_client *clp = server->nfs4_state; | 2799 | struct nfs_client *clp = server->nfs_client; |
2795 | 2800 | ||
2796 | if (!clp || task->tk_status >= 0) | 2801 | if (!clp || task->tk_status >= 0) |
2797 | return 0; | 2802 | return 0; |
@@ -2828,7 +2833,7 @@ static int nfs4_wait_bit_interruptible(void *word) | |||
2828 | return 0; | 2833 | return 0; |
2829 | } | 2834 | } |
2830 | 2835 | ||
2831 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs4_client *clp) | 2836 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp) |
2832 | { | 2837 | { |
2833 | sigset_t oldset; | 2838 | sigset_t oldset; |
2834 | int res; | 2839 | int res; |
@@ -2871,7 +2876,7 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout) | |||
2871 | */ | 2876 | */ |
2872 | int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception) | 2877 | int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception) |
2873 | { | 2878 | { |
2874 | struct nfs4_client *clp = server->nfs4_state; | 2879 | struct nfs_client *clp = server->nfs_client; |
2875 | int ret = errorcode; | 2880 | int ret = errorcode; |
2876 | 2881 | ||
2877 | exception->retry = 0; | 2882 | exception->retry = 0; |
@@ -2886,6 +2891,7 @@ int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct | |||
2886 | if (ret == 0) | 2891 | if (ret == 0) |
2887 | exception->retry = 1; | 2892 | exception->retry = 1; |
2888 | break; | 2893 | break; |
2894 | case -NFS4ERR_FILE_OPEN: | ||
2889 | case -NFS4ERR_GRACE: | 2895 | case -NFS4ERR_GRACE: |
2890 | case -NFS4ERR_DELAY: | 2896 | case -NFS4ERR_DELAY: |
2891 | ret = nfs4_delay(server->client, &exception->timeout); | 2897 | ret = nfs4_delay(server->client, &exception->timeout); |
@@ -2898,7 +2904,7 @@ int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct | |||
2898 | return nfs4_map_errors(ret); | 2904 | return nfs4_map_errors(ret); |
2899 | } | 2905 | } |
2900 | 2906 | ||
2901 | int nfs4_proc_setclientid(struct nfs4_client *clp, u32 program, unsigned short port, struct rpc_cred *cred) | 2907 | int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, unsigned short port, struct rpc_cred *cred) |
2902 | { | 2908 | { |
2903 | nfs4_verifier sc_verifier; | 2909 | nfs4_verifier sc_verifier; |
2904 | struct nfs4_setclientid setclientid = { | 2910 | struct nfs4_setclientid setclientid = { |
@@ -2922,7 +2928,7 @@ int nfs4_proc_setclientid(struct nfs4_client *clp, u32 program, unsigned short p | |||
2922 | for(;;) { | 2928 | for(;;) { |
2923 | setclientid.sc_name_len = scnprintf(setclientid.sc_name, | 2929 | setclientid.sc_name_len = scnprintf(setclientid.sc_name, |
2924 | sizeof(setclientid.sc_name), "%s/%u.%u.%u.%u %s %u", | 2930 | sizeof(setclientid.sc_name), "%s/%u.%u.%u.%u %s %u", |
2925 | clp->cl_ipaddr, NIPQUAD(clp->cl_addr.s_addr), | 2931 | clp->cl_ipaddr, NIPQUAD(clp->cl_addr.sin_addr), |
2926 | cred->cr_ops->cr_name, | 2932 | cred->cr_ops->cr_name, |
2927 | clp->cl_id_uniquifier); | 2933 | clp->cl_id_uniquifier); |
2928 | setclientid.sc_netid_len = scnprintf(setclientid.sc_netid, | 2934 | setclientid.sc_netid_len = scnprintf(setclientid.sc_netid, |
@@ -2945,7 +2951,7 @@ int nfs4_proc_setclientid(struct nfs4_client *clp, u32 program, unsigned short p | |||
2945 | return status; | 2951 | return status; |
2946 | } | 2952 | } |
2947 | 2953 | ||
2948 | static int _nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cred *cred) | 2954 | static int _nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct rpc_cred *cred) |
2949 | { | 2955 | { |
2950 | struct nfs_fsinfo fsinfo; | 2956 | struct nfs_fsinfo fsinfo; |
2951 | struct rpc_message msg = { | 2957 | struct rpc_message msg = { |
@@ -2969,7 +2975,7 @@ static int _nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cr | |||
2969 | return status; | 2975 | return status; |
2970 | } | 2976 | } |
2971 | 2977 | ||
2972 | int nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cred *cred) | 2978 | int nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct rpc_cred *cred) |
2973 | { | 2979 | { |
2974 | long timeout; | 2980 | long timeout; |
2975 | int err; | 2981 | int err; |
@@ -3077,7 +3083,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4 | |||
3077 | switch (err) { | 3083 | switch (err) { |
3078 | case -NFS4ERR_STALE_STATEID: | 3084 | case -NFS4ERR_STALE_STATEID: |
3079 | case -NFS4ERR_EXPIRED: | 3085 | case -NFS4ERR_EXPIRED: |
3080 | nfs4_schedule_state_recovery(server->nfs4_state); | 3086 | nfs4_schedule_state_recovery(server->nfs_client); |
3081 | case 0: | 3087 | case 0: |
3082 | return 0; | 3088 | return 0; |
3083 | } | 3089 | } |
@@ -3106,7 +3112,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock | |||
3106 | { | 3112 | { |
3107 | struct inode *inode = state->inode; | 3113 | struct inode *inode = state->inode; |
3108 | struct nfs_server *server = NFS_SERVER(inode); | 3114 | struct nfs_server *server = NFS_SERVER(inode); |
3109 | struct nfs4_client *clp = server->nfs4_state; | 3115 | struct nfs_client *clp = server->nfs_client; |
3110 | struct nfs_lockt_args arg = { | 3116 | struct nfs_lockt_args arg = { |
3111 | .fh = NFS_FH(inode), | 3117 | .fh = NFS_FH(inode), |
3112 | .fl = request, | 3118 | .fl = request, |
@@ -3231,7 +3237,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) | |||
3231 | break; | 3237 | break; |
3232 | case -NFS4ERR_STALE_STATEID: | 3238 | case -NFS4ERR_STALE_STATEID: |
3233 | case -NFS4ERR_EXPIRED: | 3239 | case -NFS4ERR_EXPIRED: |
3234 | nfs4_schedule_state_recovery(calldata->server->nfs4_state); | 3240 | nfs4_schedule_state_recovery(calldata->server->nfs_client); |
3235 | break; | 3241 | break; |
3236 | default: | 3242 | default: |
3237 | if (nfs4_async_handle_error(task, calldata->server) == -EAGAIN) { | 3243 | if (nfs4_async_handle_error(task, calldata->server) == -EAGAIN) { |
@@ -3343,7 +3349,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
3343 | if (p->arg.lock_seqid == NULL) | 3349 | if (p->arg.lock_seqid == NULL) |
3344 | goto out_free; | 3350 | goto out_free; |
3345 | p->arg.lock_stateid = &lsp->ls_stateid; | 3351 | p->arg.lock_stateid = &lsp->ls_stateid; |
3346 | p->arg.lock_owner.clientid = server->nfs4_state->cl_clientid; | 3352 | p->arg.lock_owner.clientid = server->nfs_client->cl_clientid; |
3347 | p->arg.lock_owner.id = lsp->ls_id; | 3353 | p->arg.lock_owner.id = lsp->ls_id; |
3348 | p->lsp = lsp; | 3354 | p->lsp = lsp; |
3349 | atomic_inc(&lsp->ls_count); | 3355 | atomic_inc(&lsp->ls_count); |
@@ -3513,7 +3519,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request | |||
3513 | 3519 | ||
3514 | static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) | 3520 | static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) |
3515 | { | 3521 | { |
3516 | struct nfs4_client *clp = state->owner->so_client; | 3522 | struct nfs_client *clp = state->owner->so_client; |
3517 | unsigned char fl_flags = request->fl_flags; | 3523 | unsigned char fl_flags = request->fl_flags; |
3518 | int status; | 3524 | int status; |
3519 | 3525 | ||
@@ -3715,7 +3721,7 @@ static struct inode_operations nfs4_file_inode_operations = { | |||
3715 | .listxattr = nfs4_listxattr, | 3721 | .listxattr = nfs4_listxattr, |
3716 | }; | 3722 | }; |
3717 | 3723 | ||
3718 | struct nfs_rpc_ops nfs_v4_clientops = { | 3724 | const struct nfs_rpc_ops nfs_v4_clientops = { |
3719 | .version = 4, /* protocol version */ | 3725 | .version = 4, /* protocol version */ |
3720 | .dentry_ops = &nfs4_dentry_operations, | 3726 | .dentry_ops = &nfs4_dentry_operations, |
3721 | .dir_inode_ops = &nfs4_dir_inode_operations, | 3727 | .dir_inode_ops = &nfs4_dir_inode_operations, |
@@ -3723,6 +3729,7 @@ struct nfs_rpc_ops nfs_v4_clientops = { | |||
3723 | .getroot = nfs4_proc_get_root, | 3729 | .getroot = nfs4_proc_get_root, |
3724 | .getattr = nfs4_proc_getattr, | 3730 | .getattr = nfs4_proc_getattr, |
3725 | .setattr = nfs4_proc_setattr, | 3731 | .setattr = nfs4_proc_setattr, |
3732 | .lookupfh = nfs4_proc_lookupfh, | ||
3726 | .lookup = nfs4_proc_lookup, | 3733 | .lookup = nfs4_proc_lookup, |
3727 | .access = nfs4_proc_access, | 3734 | .access = nfs4_proc_access, |
3728 | .readlink = nfs4_proc_readlink, | 3735 | .readlink = nfs4_proc_readlink, |
@@ -3743,6 +3750,7 @@ struct nfs_rpc_ops nfs_v4_clientops = { | |||
3743 | .statfs = nfs4_proc_statfs, | 3750 | .statfs = nfs4_proc_statfs, |
3744 | .fsinfo = nfs4_proc_fsinfo, | 3751 | .fsinfo = nfs4_proc_fsinfo, |
3745 | .pathconf = nfs4_proc_pathconf, | 3752 | .pathconf = nfs4_proc_pathconf, |
3753 | .set_capabilities = nfs4_server_capabilities, | ||
3746 | .decode_dirent = nfs4_decode_dirent, | 3754 | .decode_dirent = nfs4_decode_dirent, |
3747 | .read_setup = nfs4_proc_read_setup, | 3755 | .read_setup = nfs4_proc_read_setup, |
3748 | .read_done = nfs4_read_done, | 3756 | .read_done = nfs4_read_done, |