Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp343843rwb; Fri, 2 Sep 2022 15:23:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR71LIdN+AsFTmFYEui/jsuWwqw6v0xcQ4HMC65f8q8fIfYlOwgAkJ6dM8eVLVfNHr8WiCw8 X-Received: by 2002:a05:6a00:27a0:b0:52f:8947:4cc5 with SMTP id bd32-20020a056a0027a000b0052f89474cc5mr38709830pfb.16.1662157396473; Fri, 02 Sep 2022 15:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662157396; cv=none; d=google.com; s=arc-20160816; b=n+F7ItBBFoobhDZ+UxTBJjsLCZq5ZNLJ2X5aops1HPwqqPz1hJX8PYA7xHggJLnpWM XD+fK7lcPW4Ee3ja2gQ3blLEYNAGsb0nMdd/+M9iYUdQJjnO088jbRw2JO2Mj5ldwQqU ZNRzXbWLw8hX2++IQR0U3iktcc3eclhJAU/wuaNDrwU31QCNLOy+2zorjvB9p7gZd6Yz XTXZKOrcmXDEHxNm9JhwsqbaVrPApQTSZdC9wQUiCquNe2wYLgHcFF0HN0VJOAf24MYa jr9/YV5+CoB8M1vUvSCmdsI/FPzeNURrNvCgXW0Ay4d18lYC+x9f2WwfCz+hNtarm10s +nyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:to:from:subject; bh=snMBQy9kPMMFk7At1+8+4lTfA7Z/b96r98sG1bBVLn8=; b=wktdnVOtDWr1vEeCfrTMZFhKkDzueLUwdx0q8tPu/HmIhRSzigD7VHg1QC3grIQuJ0 JOe1RF9ykZRnlIfkQQ0vH5II8YFvDZNxC461UNu7v+jYqdE/84vbINTT55aZmpEIXLY2 U7E4p/K/81UfSEwZEjeCIwfxTc73JnU45G45Z7tm+4pl57wBcFa8a25a0WFabmzfY/N1 C/zDGCnCS6IXYTCHqMu+LMmt3klzvlrWghO2uPkUyVDiBJcGT4HW3UWo/3JFgvyU+7d9 pBMmeUF5tFVxReZWSLydx+FzMHDFpsLrBHlW0BVoq9jhnwh8KRvY8FL3+KEq5/gyGNec 07EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il15-20020a17090b164f00b001fbaae57ae1si3693903pjb.170.2022.09.02.15.22.47; Fri, 02 Sep 2022 15:23:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbiIBWRK (ORCPT + 99 others); Fri, 2 Sep 2022 18:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbiIBWRI (ORCPT ); Fri, 2 Sep 2022 18:17:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A7BB4EB7 for ; Fri, 2 Sep 2022 15:17:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4CD5B82DE4 for ; Fri, 2 Sep 2022 22:17:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 506B2C43140 for ; Fri, 2 Sep 2022 22:17:04 +0000 (UTC) Subject: [PATCH v2] NFSD: Increase NFSD_MAX_OPS_PER_COMPOUND From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Fri, 02 Sep 2022 18:17:03 -0400 Message-ID: <166215702314.2717.14850705510680985267.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org When attempting an NFSv4 mount, a Solaris NFSv4 client builds a single large COMPOUND that chains a series of LOOKUPs to get to the pseudo filesystem root directory that is to be mounted. The Linux NFS server's current maximum of 16 operations per NFSv4 COMPOUND is not large enough to ensure that this works for paths that are more than a few components deep. Since NFSD_MAX_OPS_PER_COMPOUND is mostly a sanity check, and most NFSv4 COMPOUNDS are between 3 and 6 operations (thus they do not trigger any re-allocation of the operation array on the server), increasing this maximum should result in little to no impact. The ops array can get large now, so allocate it via vmalloc() to help ensure memory fragmentation won't cause an allocation failure. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216383 Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 5 ++--- fs/nfsd/state.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 1e9690a061ec..a04b9b29678f 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2369,10 +2369,9 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) return true; if (argp->opcnt > ARRAY_SIZE(argp->iops)) { - argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); + argp->ops = vcalloc(argp->opcnt, sizeof(*argp->ops)); if (!argp->ops) { argp->ops = argp->iops; - dprintk("nfsd: couldn't allocate room for COMPOUND\n"); return false; } } @@ -5394,7 +5393,7 @@ void nfsd4_release_compoundargs(struct svc_rqst *rqstp) struct nfsd4_compoundargs *args = rqstp->rq_argp; if (args->ops != args->iops) { - kfree(args->ops); + vfree(args->ops); args->ops = args->iops; } while (args->to_free) { diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index ae596dbf8667..5d28beb290fe 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -175,7 +175,7 @@ static inline struct nfs4_delegation *delegstateid(struct nfs4_stid *s) /* Maximum number of slots per session. 160 is useful for long haul TCP */ #define NFSD_MAX_SLOTS_PER_SESSION 160 /* Maximum number of operations per session compound */ -#define NFSD_MAX_OPS_PER_COMPOUND 16 +#define NFSD_MAX_OPS_PER_COMPOUND 50 /* Maximum session per slot cache size */ #define NFSD_SLOT_CACHE_SIZE 2048 /* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */