diff options
author | Benny Halevy <bhalevy@panasas.com> | 2009-04-01 09:22:50 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 15:25:13 -0400 |
commit | 008f55d0e019943323c20a03493a2ba5672a4cc8 (patch) | |
tree | 9d23ac89a198b307fa39018a228bd365e72a40d2 | |
parent | b4b82607ffcf09b57301846d154f2c09c0b807c0 (diff) |
nfs41: recover lease in _nfs4_lookup_root
This creates the nfsv4.1 session on mount.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/client.c | 16 | ||||
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 9 |
3 files changed, 25 insertions, 1 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index d28a987f569e..3e232bf56dfb 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -528,6 +528,22 @@ void nfs_mark_client_ready(struct nfs_client *clp, int state) | |||
528 | } | 528 | } |
529 | 529 | ||
530 | /* | 530 | /* |
531 | * With sessions, the client is not marked ready until after a | ||
532 | * successful EXCHANGE_ID and CREATE_SESSION. | ||
533 | * | ||
534 | * Map errors cl_cons_state errors to EPROTONOSUPPORT to indicate | ||
535 | * other versions of NFS can be tried. | ||
536 | */ | ||
537 | int nfs4_check_client_ready(struct nfs_client *clp) | ||
538 | { | ||
539 | if (!nfs4_has_session(clp)) | ||
540 | return 0; | ||
541 | if (clp->cl_cons_state < NFS_CS_READY) | ||
542 | return -EPROTONOSUPPORT; | ||
543 | return 0; | ||
544 | } | ||
545 | |||
546 | /* | ||
531 | * Initialise the timeout values for a connection | 547 | * Initialise the timeout values for a connection |
532 | */ | 548 | */ |
533 | static void nfs_init_timeout_values(struct rpc_timeout *to, int proto, | 549 | static void nfs_init_timeout_values(struct rpc_timeout *to, int proto, |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 78508f29c03a..acee3274d275 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -114,6 +114,7 @@ extern struct nfs_server *nfs_clone_server(struct nfs_server *, | |||
114 | struct nfs_fh *, | 114 | struct nfs_fh *, |
115 | struct nfs_fattr *); | 115 | struct nfs_fattr *); |
116 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); | 116 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); |
117 | extern int nfs4_check_client_ready(struct nfs_client *clp); | ||
117 | #ifdef CONFIG_PROC_FS | 118 | #ifdef CONFIG_PROC_FS |
118 | extern int __init nfs_fs_proc_init(void); | 119 | extern int __init nfs_fs_proc_init(void); |
119 | extern void nfs_fs_proc_exit(void); | 120 | extern void nfs_fs_proc_exit(void); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 64d611658d1f..31ce758d53d5 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2024,8 +2024,15 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
2024 | .rpc_argp = &args, | 2024 | .rpc_argp = &args, |
2025 | .rpc_resp = &res, | 2025 | .rpc_resp = &res, |
2026 | }; | 2026 | }; |
2027 | int status; | ||
2028 | |||
2027 | nfs_fattr_init(info->fattr); | 2029 | nfs_fattr_init(info->fattr); |
2028 | return nfs4_call_sync(server, &msg, &args, &res, 0); | 2030 | status = nfs4_recover_expired_lease(server); |
2031 | if (!status) | ||
2032 | status = nfs4_check_client_ready(server->nfs_client); | ||
2033 | if (!status) | ||
2034 | status = nfs4_call_sync(server, &msg, &args, &res, 0); | ||
2035 | return status; | ||
2029 | } | 2036 | } |
2030 | 2037 | ||
2031 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | 2038 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, |