Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp348834rdb; Tue, 5 Dec 2023 07:10:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IF42los8pflwahSmtKMI0dqN1+UHa0lm3udgBlaaNlq1+OdxcrmummA9LAeL7WwKItVrYGw X-Received: by 2002:a05:6808:1701:b0:3b2:e5cb:8e53 with SMTP id bc1-20020a056808170100b003b2e5cb8e53mr6670634oib.10.1701789024376; Tue, 05 Dec 2023 07:10:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701789024; cv=none; d=google.com; s=arc-20160816; b=SofMd8PNcyM+N6gDhKo5XIRZOj07OlLUA5igag5YBi0f5ePFp/63pKDSKuw5JbOIgT uB40saFc0Dj3beoP/luvL80qXJ8NKCgdEBmSkf4zIG8fk9INCNi5OibGFDjXKr05NtaH +GjIjNfYSAoT9HC77mETPKPR23vJJCFTbJW9/OJKRmb0Qh/ysBHQiRF4SNzwvyvAeTJR rmCM7f0DmCINVI/9ZYsYZfFqjT9AIN0vEkk6MywP2vy0ouzt91QlrBrMwQNjeUCDVZ/R K2u9WSRo74k4+OH4uZw/2zSp1p14NzWypvAvxKP6lZrFUT4Ag0iwRseYorw55xx9yphr NfJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=QtFs7NsVU7SVJ5MjsiLt5FmizdYLVvWHRBit2OFQ/58=; fh=kMe8ipV+H2zZMCwplNV8b/uzUHICYp+b9TeU6KoaKrQ=; b=OTLugDxEdp9oX4R0ajtvgYHh6QVmntieAgfMY3Yd9tg2X0QfpCbCZf+BsmOl9iWNwC BbHgroodCSZYdhEIWP2QBQidW/OCohZ9K1wAfyav0lfhWTnvCwXPihQlIux6gNMTkyVI k4aT9DbWmCcf4IZoBg81Q3iNkX8JyqJb21qGz2lPjLCBmS+VI0zFnqVzrdrfKgP3DWIM 32sgEi/DLBQvlA2Ge/tzbl81PGvtc3ptMrQnjg7HvM+/yx2/4zkFzbU5MT0nzPfQOJhc aOr40NoBmO0WQuorPFzKwXkbn8A/lkBlwmy+IV0Smn7PJX9UN1NXZrsr2V+IlQBVZvJ/ gKVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CMPNH0oh; spf=pass (google.com: domain of linux-nfs+bounces-339-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-339-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t7-20020a05610210c700b00464a0fad6a8si609668vsr.755.2023.12.05.07.10.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 07:10:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-339-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CMPNH0oh; spf=pass (google.com: domain of linux-nfs+bounces-339-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-339-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 05D811C208DB for ; Tue, 5 Dec 2023 15:10:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9442B67E8F; Tue, 5 Dec 2023 15:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CMPNH0oh" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 097B5BA for ; Tue, 5 Dec 2023 07:10:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701789017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QtFs7NsVU7SVJ5MjsiLt5FmizdYLVvWHRBit2OFQ/58=; b=CMPNH0oh+gU4MKyDo62t2MBSMwWDvjLCDUY6Hg5AN1inzpRSbR3sQbxzTggo9sOKrONZA9 GrWZvK8Y9RCK0TMKlpMjzmEAvo3bsJMP0OqqQTcQ5FIZLE2Rvm3efy6OfqhMfdIXTxFCSq xTozymNoLXKfLu35Q/aYD6UFdFZC9YQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-gFsE1sNvMzaJUTzwLZaBtQ-1; Tue, 05 Dec 2023 10:08:49 -0500 X-MC-Unique: gFsE1sNvMzaJUTzwLZaBtQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D1DE102F141; Tue, 5 Dec 2023 15:08:46 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.48.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5E5151E3; Tue, 5 Dec 2023 15:08:45 +0000 (UTC) From: Benjamin Coddington To: trond.myklebust@hammerspace.com, anna@kernel.org Cc: linux-nfs@vger.kernel.org Subject: [RESEND PATCH] NFSv4: Always ask for type with READDIR Date: Tue, 5 Dec 2023 10:08:45 -0500 Message-ID: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Again we have claimed regressions for walking a directory tree, this time with the "find" utility which always tries to optimize away asking for any attributes until it has a complete list of entries. This behavior makes the readdir plus heuristic do the wrong thing, which causes a storm of GETATTRs to determine each entry's type in order to continue the walk. For v4 add the type attribute to each READDIR request to include it no matter the heuristic. This allows a simple `find` command to proceed quickly through a directory tree. Suggested-by: Jeff Layton Signed-off-by: Benjamin Coddington Reviewed-by: Jeff Layton --- fs/nfs/nfs4xdr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index deec76cf5afe..7200d6f7cd7b 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -1602,7 +1602,7 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_pgio_args *args static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr) { uint32_t attrs[3] = { - FATTR4_WORD0_RDATTR_ERROR, + FATTR4_WORD0_TYPE|FATTR4_WORD0_RDATTR_ERROR, FATTR4_WORD1_MOUNTED_ON_FILEID, }; uint32_t dircount = readdir->count; @@ -1612,7 +1612,7 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg unsigned int i; if (readdir->plus) { - attrs[0] |= FATTR4_WORD0_TYPE|FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE| + attrs[0] |= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE| FATTR4_WORD0_FSID|FATTR4_WORD0_FILEHANDLE|FATTR4_WORD0_FILEID; attrs[1] |= FATTR4_WORD1_MODE|FATTR4_WORD1_NUMLINKS|FATTR4_WORD1_OWNER| FATTR4_WORD1_OWNER_GROUP|FATTR4_WORD1_RAWDEV| -- 2.43.0