diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/dir.c | 5 | ||||
-rw-r--r-- | fs/nfs/inode.c | 88 |
2 files changed, 51 insertions, 42 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2df639f143e8..c70eabd6d179 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -565,8 +565,6 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
565 | } | 565 | } |
566 | } | 566 | } |
567 | unlock_kernel(); | 567 | unlock_kernel(); |
568 | if (desc->error < 0) | ||
569 | return desc->error; | ||
570 | if (res < 0) | 568 | if (res < 0) |
571 | return res; | 569 | return res; |
572 | return 0; | 570 | return 0; |
@@ -1539,7 +1537,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1539 | #endif | 1537 | #endif |
1540 | goto out; | 1538 | goto out; |
1541 | } | 1539 | } |
1542 | } | 1540 | } else |
1541 | new_inode->i_nlink--; | ||
1543 | 1542 | ||
1544 | go_ahead: | 1543 | go_ahead: |
1545 | /* | 1544 | /* |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d4eadeea128e..d7abaa00473a 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -358,6 +358,35 @@ out_no_root: | |||
358 | return no_root_error; | 358 | return no_root_error; |
359 | } | 359 | } |
360 | 360 | ||
361 | static void nfs_init_timeout_values(struct rpc_timeout *to, int proto, unsigned int timeo, unsigned int retrans) | ||
362 | { | ||
363 | to->to_initval = timeo * HZ / 10; | ||
364 | to->to_retries = retrans; | ||
365 | if (!to->to_retries) | ||
366 | to->to_retries = 2; | ||
367 | |||
368 | switch (proto) { | ||
369 | case IPPROTO_TCP: | ||
370 | if (!to->to_initval) | ||
371 | to->to_initval = 60 * HZ; | ||
372 | if (to->to_initval > NFS_MAX_TCP_TIMEOUT) | ||
373 | to->to_initval = NFS_MAX_TCP_TIMEOUT; | ||
374 | to->to_increment = to->to_initval; | ||
375 | to->to_maxval = to->to_initval + (to->to_increment * to->to_retries); | ||
376 | to->to_exponential = 0; | ||
377 | break; | ||
378 | case IPPROTO_UDP: | ||
379 | default: | ||
380 | if (!to->to_initval) | ||
381 | to->to_initval = 11 * HZ / 10; | ||
382 | if (to->to_initval > NFS_MAX_UDP_TIMEOUT) | ||
383 | to->to_initval = NFS_MAX_UDP_TIMEOUT; | ||
384 | to->to_maxval = NFS_MAX_UDP_TIMEOUT; | ||
385 | to->to_exponential = 1; | ||
386 | break; | ||
387 | } | ||
388 | } | ||
389 | |||
361 | /* | 390 | /* |
362 | * Create an RPC client handle. | 391 | * Create an RPC client handle. |
363 | */ | 392 | */ |
@@ -367,22 +396,12 @@ nfs_create_client(struct nfs_server *server, const struct nfs_mount_data *data) | |||
367 | struct rpc_timeout timeparms; | 396 | struct rpc_timeout timeparms; |
368 | struct rpc_xprt *xprt = NULL; | 397 | struct rpc_xprt *xprt = NULL; |
369 | struct rpc_clnt *clnt = NULL; | 398 | struct rpc_clnt *clnt = NULL; |
370 | int tcp = (data->flags & NFS_MOUNT_TCP); | 399 | int proto = (data->flags & NFS_MOUNT_TCP) ? IPPROTO_TCP : IPPROTO_UDP; |
371 | |||
372 | /* Initialize timeout values */ | ||
373 | timeparms.to_initval = data->timeo * HZ / 10; | ||
374 | timeparms.to_retries = data->retrans; | ||
375 | timeparms.to_maxval = tcp ? RPC_MAX_TCP_TIMEOUT : RPC_MAX_UDP_TIMEOUT; | ||
376 | timeparms.to_exponential = 1; | ||
377 | 400 | ||
378 | if (!timeparms.to_initval) | 401 | nfs_init_timeout_values(&timeparms, proto, data->timeo, data->retrans); |
379 | timeparms.to_initval = (tcp ? 600 : 11) * HZ / 10; | ||
380 | if (!timeparms.to_retries) | ||
381 | timeparms.to_retries = 5; | ||
382 | 402 | ||
383 | /* create transport and client */ | 403 | /* create transport and client */ |
384 | xprt = xprt_create_proto(tcp ? IPPROTO_TCP : IPPROTO_UDP, | 404 | xprt = xprt_create_proto(proto, &server->addr, &timeparms); |
385 | &server->addr, &timeparms); | ||
386 | if (IS_ERR(xprt)) { | 405 | if (IS_ERR(xprt)) { |
387 | dprintk("%s: cannot create RPC transport. Error = %ld\n", | 406 | dprintk("%s: cannot create RPC transport. Error = %ld\n", |
388 | __FUNCTION__, PTR_ERR(xprt)); | 407 | __FUNCTION__, PTR_ERR(xprt)); |
@@ -576,7 +595,6 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
576 | { NFS_MOUNT_SOFT, ",soft", ",hard" }, | 595 | { NFS_MOUNT_SOFT, ",soft", ",hard" }, |
577 | { NFS_MOUNT_INTR, ",intr", "" }, | 596 | { NFS_MOUNT_INTR, ",intr", "" }, |
578 | { NFS_MOUNT_POSIX, ",posix", "" }, | 597 | { NFS_MOUNT_POSIX, ",posix", "" }, |
579 | { NFS_MOUNT_TCP, ",tcp", ",udp" }, | ||
580 | { NFS_MOUNT_NOCTO, ",nocto", "" }, | 598 | { NFS_MOUNT_NOCTO, ",nocto", "" }, |
581 | { NFS_MOUNT_NOAC, ",noac", "" }, | 599 | { NFS_MOUNT_NOAC, ",noac", "" }, |
582 | { NFS_MOUNT_NONLM, ",nolock", ",lock" }, | 600 | { NFS_MOUNT_NONLM, ",nolock", ",lock" }, |
@@ -585,6 +603,8 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
585 | }; | 603 | }; |
586 | struct proc_nfs_info *nfs_infop; | 604 | struct proc_nfs_info *nfs_infop; |
587 | struct nfs_server *nfss = NFS_SB(mnt->mnt_sb); | 605 | struct nfs_server *nfss = NFS_SB(mnt->mnt_sb); |
606 | char buf[12]; | ||
607 | char *proto; | ||
588 | 608 | ||
589 | seq_printf(m, ",v%d", nfss->rpc_ops->version); | 609 | seq_printf(m, ",v%d", nfss->rpc_ops->version); |
590 | seq_printf(m, ",rsize=%d", nfss->rsize); | 610 | seq_printf(m, ",rsize=%d", nfss->rsize); |
@@ -603,6 +623,18 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
603 | else | 623 | else |
604 | seq_puts(m, nfs_infop->nostr); | 624 | seq_puts(m, nfs_infop->nostr); |
605 | } | 625 | } |
626 | switch (nfss->client->cl_xprt->prot) { | ||
627 | case IPPROTO_TCP: | ||
628 | proto = "tcp"; | ||
629 | break; | ||
630 | case IPPROTO_UDP: | ||
631 | proto = "udp"; | ||
632 | break; | ||
633 | default: | ||
634 | snprintf(buf, sizeof(buf), "%u", nfss->client->cl_xprt->prot); | ||
635 | proto = buf; | ||
636 | } | ||
637 | seq_printf(m, ",proto=%s", proto); | ||
606 | seq_puts(m, ",addr="); | 638 | seq_puts(m, ",addr="); |
607 | seq_escape(m, nfss->hostname, " \t\n\\"); | 639 | seq_escape(m, nfss->hostname, " \t\n\\"); |
608 | return 0; | 640 | return 0; |
@@ -1669,7 +1701,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
1669 | struct rpc_clnt *clnt = NULL; | 1701 | struct rpc_clnt *clnt = NULL; |
1670 | struct rpc_timeout timeparms; | 1702 | struct rpc_timeout timeparms; |
1671 | rpc_authflavor_t authflavour; | 1703 | rpc_authflavor_t authflavour; |
1672 | int proto, err = -EIO; | 1704 | int err = -EIO; |
1673 | 1705 | ||
1674 | sb->s_blocksize_bits = 0; | 1706 | sb->s_blocksize_bits = 0; |
1675 | sb->s_blocksize = 0; | 1707 | sb->s_blocksize = 0; |
@@ -1687,30 +1719,8 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
1687 | server->acdirmax = data->acdirmax*HZ; | 1719 | server->acdirmax = data->acdirmax*HZ; |
1688 | 1720 | ||
1689 | server->rpc_ops = &nfs_v4_clientops; | 1721 | server->rpc_ops = &nfs_v4_clientops; |
1690 | /* Initialize timeout values */ | ||
1691 | 1722 | ||
1692 | timeparms.to_initval = data->timeo * HZ / 10; | 1723 | nfs_init_timeout_values(&timeparms, data->proto, data->timeo, data->retrans); |
1693 | timeparms.to_retries = data->retrans; | ||
1694 | timeparms.to_exponential = 1; | ||
1695 | if (!timeparms.to_retries) | ||
1696 | timeparms.to_retries = 5; | ||
1697 | |||
1698 | proto = data->proto; | ||
1699 | /* Which IP protocol do we use? */ | ||
1700 | switch (proto) { | ||
1701 | case IPPROTO_TCP: | ||
1702 | timeparms.to_maxval = RPC_MAX_TCP_TIMEOUT; | ||
1703 | if (!timeparms.to_initval) | ||
1704 | timeparms.to_initval = 600 * HZ / 10; | ||
1705 | break; | ||
1706 | case IPPROTO_UDP: | ||
1707 | timeparms.to_maxval = RPC_MAX_UDP_TIMEOUT; | ||
1708 | if (!timeparms.to_initval) | ||
1709 | timeparms.to_initval = 11 * HZ / 10; | ||
1710 | break; | ||
1711 | default: | ||
1712 | return -EINVAL; | ||
1713 | } | ||
1714 | 1724 | ||
1715 | clp = nfs4_get_client(&server->addr.sin_addr); | 1725 | clp = nfs4_get_client(&server->addr.sin_addr); |
1716 | if (!clp) { | 1726 | if (!clp) { |
@@ -1735,7 +1745,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
1735 | 1745 | ||
1736 | down_write(&clp->cl_sem); | 1746 | down_write(&clp->cl_sem); |
1737 | if (IS_ERR(clp->cl_rpcclient)) { | 1747 | if (IS_ERR(clp->cl_rpcclient)) { |
1738 | xprt = xprt_create_proto(proto, &server->addr, &timeparms); | 1748 | xprt = xprt_create_proto(data->proto, &server->addr, &timeparms); |
1739 | if (IS_ERR(xprt)) { | 1749 | if (IS_ERR(xprt)) { |
1740 | up_write(&clp->cl_sem); | 1750 | up_write(&clp->cl_sem); |
1741 | err = PTR_ERR(xprt); | 1751 | err = PTR_ERR(xprt); |