Received: by 10.213.65.68 with SMTP id h4csp2760123imn; Mon, 9 Apr 2018 08:36:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+WqnzYBIBvVdXJwnWI11MDCbbLP3RNKJxb69TeCi0q2BJC7lqxavbf/2VNnbgPaeikKmk8 X-Received: by 10.167.130.2 with SMTP id k2mr25708561pfi.14.1523288180266; Mon, 09 Apr 2018 08:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523288180; cv=none; d=google.com; s=arc-20160816; b=K1l053adMfjR02apwIF5IvrQccVI+pJKyGzhsB5IvHrMsF0742pzlPTh/kWCaI2qvA kx0thzrml9WjpHsP38lxHr1lma/YczYNQh7svwTcP+5VpL/0JGKV2nST7So1/pt5x70r lM+eS8gYe8cnZ4USnf96CkRFjRh/DQfuOTatL3krN3j61oEPgymCknctm+53x32M6Li9 UzTkaYQHYTw6LTwXE8bAbjltNiccQGJF/arPnZPKwmUHONDIOAWqZWadhZs5Y9OSFEBi V5K7vD4NbEDK/vrJA+gw9CTcEcJf8bmfj38vLflTtx8XB/t8h+NV1M1gdiMRolzc51su B43Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xexnANilyITp1BezSAKVBJe7ZcsbVg86ctbwfoBdMcg=; b=rbYuBMxkGomBwUoc3V3bU6ktAORLrQBd4oYW+CV6jeOGidpr6/FQQIWhjmXvxIFqs2 NK0OmfiL2qVP4KvD9DiIi4WuFlm9NXz6GUy8EqARmZa8EQttcmqoS+asxaHAsPilGRtD um8HptKjje/w7jKGyiiTTXfuP0bimIinr/a5AKToI8y4WhhMetwrU8wWOfjR2vFeMmRA L0G3Xo/l2PQY1ee3e5Xg4ALeK8Gyao1OJLjCLYfpdgDWbQdAitO0XSDJhiAtUGQ5rq+d Ke0qxtPaJFNPNKTmZrkWVC2hZ0RZVy4mhiu+PApzaAeHkblH16CqmXUxgAUjM0MW82lZ hO/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si536485pln.533.2018.04.09.08.35.19; Mon, 09 Apr 2018 08:36:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753211AbeDIP2L (ORCPT + 99 others); Mon, 9 Apr 2018 11:28:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43710 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752961AbeDIP2J (ORCPT ); Mon, 9 Apr 2018 11:28:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 537F040F25; Mon, 9 Apr 2018 15:28:09 +0000 (UTC) Received: from parsley.fieldses.org (ovpn-116-101.phx2.redhat.com [10.3.116.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D51E18B3D; Mon, 9 Apr 2018 15:28:08 +0000 (UTC) Received: by parsley.fieldses.org (Postfix, from userid 2815) id 219F618052C; Mon, 9 Apr 2018 11:27:47 -0400 (EDT) Date: Mon, 9 Apr 2018 11:27:47 -0400 From: "J. Bruce Fields" To: Sasha Levin Cc: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH AUTOSEL for 4.15 168/189] nfsd: return RESOURCE not GARBAGE_ARGS on too many ops Message-ID: <20180409152746.GA25317@parsley.fieldses.org> References: <20180409001637.162453-1-alexander.levin@microsoft.com> <20180409001637.162453-168-alexander.levin@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180409001637.162453-168-alexander.levin@microsoft.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 09 Apr 2018 15:28:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org What's your default on these patches on these AUTOSEL patches if you don't get an ACK or NACK? Do you apply them anyway? (I'd skip this one as it doesn't meet the "It must fix a real bug that bothers people" criterion. But I don't recall it *causing* any bugs either, so the stakes are low, I'm mainly just curious.) --b. On Mon, Apr 09, 2018 at 12:19:02AM +0000, Sasha Levin wrote: > From: "J. Bruce Fields" > > [ Upstream commit 0078117c6d9160031b866cfa1853514d4f6865d2 ] > > A client that sends more than a hundred ops in a single compound > currently gets an rpc-level GARBAGE_ARGS error. > > It would be more helpful to return NFS4ERR_RESOURCE, since that gives > the client a better idea how to recover (for example by splitting up the > compound into smaller compounds). > > This is all a bit academic since we've never actually seen a reason for > clients to send such long compounds, but we may as well fix it. > > While we're there, just use NFSD4_MAX_OPS_PER_COMPOUND == 16, the > constant we already use in the 4.1 case, instead of hard-coding 100. > Chances anyone actually uses even 16 ops per compound are small enough > that I think there's a neglible risk or any regression. > > This fixes pynfs test COMP6. > > Reported-by: "Lu, Xinyu" > Signed-off-by: J. Bruce Fields > Signed-off-by: Sasha Levin > --- > fs/nfsd/nfs4proc.c | 3 +++ > fs/nfsd/nfs4xdr.c | 9 +++++++-- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c > index effeeb4f556f..a0bed2b2004d 100644 > --- a/fs/nfsd/nfs4proc.c > +++ b/fs/nfsd/nfs4proc.c > @@ -1703,6 +1703,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) > status = nfserr_minor_vers_mismatch; > if (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0) > goto out; > + status = nfserr_resource; > + if (args->opcnt > NFSD_MAX_OPS_PER_COMPOUND) > + goto out; > > status = nfs41_check_op_ordering(args); > if (status) { > diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c > index 2c61c6b8ae09..5dcd7cb45b2d 100644 > --- a/fs/nfsd/nfs4xdr.c > +++ b/fs/nfsd/nfs4xdr.c > @@ -1918,8 +1918,13 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) > > if (argp->taglen > NFSD4_MAX_TAGLEN) > goto xdr_error; > - if (argp->opcnt > 100) > - goto xdr_error; > + /* > + * NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS > + * here, so we return success at the xdr level so that > + * nfsd4_proc can handle this is an NFS-level error. > + */ > + if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND) > + return 0; > > if (argp->opcnt > ARRAY_SIZE(argp->iops)) { > argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); > -- > 2.15.1