]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
nfs41: fix session fore channel negotiation
authorAndy Adamson <andros@netapp.com>
Tue, 15 Dec 2009 17:55:02 +0000 (12:55 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 15 Dec 2009 18:58:42 +0000 (13:58 -0500)
If the rsize or wsize is not set on the mount command, negotiate the highest
supported rsize and wsize in session creation.

Fixes a bug where the client negotiated nfs41_maxwrite_overhead as
ca_maxrequestsize and nfs41_maxread_overhead as ca_maxresponsesize resulting
in NFS4ERR_REQ_TOO_BIG errors on writes.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c

index bd4555fbdf251248d6602f17ae5c2b42309738c1..019a009e73a08629f82f23b6a1fae5da973c1f17 100644 (file)
@@ -4935,14 +4935,22 @@ int nfs4_init_session(struct nfs_server *server)
 {
        struct nfs_client *clp = server->nfs_client;
        struct nfs4_session *session;
+       unsigned int rsize, wsize;
        int ret;
 
        if (!nfs4_has_session(clp))
                return 0;
 
+       rsize = server->rsize;
+       if (rsize == 0)
+               rsize = NFS_MAX_FILE_IO_SIZE;
+       wsize = server->wsize;
+       if (wsize == 0)
+               wsize = NFS_MAX_FILE_IO_SIZE;
+
        session = clp->cl_session;
-       session->fc_attrs.max_rqst_sz = server->wsize + nfs41_maxwrite_overhead;
-       session->fc_attrs.max_resp_sz = server->rsize + nfs41_maxread_overhead;
+       session->fc_attrs.max_rqst_sz = wsize + nfs41_maxwrite_overhead;
+       session->fc_attrs.max_resp_sz = rsize + nfs41_maxread_overhead;
 
        ret = nfs4_recover_expired_lease(server);
        if (!ret)