From patchwork Thu Jun 9 10:53:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 12875249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3C93C43334 for ; Thu, 9 Jun 2022 10:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243153AbiFIKxO (ORCPT ); Thu, 9 Jun 2022 06:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242966AbiFIKxL (ORCPT ); Thu, 9 Jun 2022 06:53:11 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52CEBE085; Thu, 9 Jun 2022 03:53:05 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 90A261F909; Thu, 9 Jun 2022 10:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1654771984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rEmJn680m/TQKB4Uu9ncMP6P+6Qq9FOSqC0c0ffBrNQ=; b=kvFwpF0xpDVIUkb6DFF2EPAltgZHnU1UhjGdNOSb6YL4T+qzYZrVO/H7eDKtbrqaDAJnaj RxV4Q8pvZxJJIrEqHOnhIKNuTfaSr5cnTpxQXXCEe3Wg3BIIIHMC0eKzeosT6ExrRqeas+ bOTUA+G52MZZxJCwBe9R77AXtRw7pnE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1654771984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rEmJn680m/TQKB4Uu9ncMP6P+6Qq9FOSqC0c0ffBrNQ=; b=YV/LYmVrKiXcNCqezPvErvJg3qZYMGFCifHpRGfU6XqqlLHh+PPsaW+6GBsb5h2pJTMPVj HBM7HCwUG3TErsDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1AB1513456; Thu, 9 Jun 2022 10:53:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iPSEAxDRoWK1EAAAMHmgww (envelope-from ); Thu, 09 Jun 2022 10:53:04 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id b14799e5; Thu, 9 Jun 2022 10:53:44 +0000 (UTC) From: =?utf-8?q?Lu=C3=ADs_Henriques?= To: fstests@vger.kernel.org Cc: Dave Chinner , "Darrick J. Wong" , Jeff Layton , Xiubo Li , ceph-devel@vger.kernel.org, =?utf-8?q?Lu=C3=ADs_Henriques?= Subject: [PATCH v2 2/2] generic/486: adjust the max xattr size Date: Thu, 9 Jun 2022 11:53:43 +0100 Message-Id: <20220609105343.13591-3-lhenriques@suse.de> In-Reply-To: <20220609105343.13591-1-lhenriques@suse.de> References: <20220609105343.13591-1-lhenriques@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org CephFS doesn't have a maximum xattr size. Instead, it imposes a maximum size for the full set of xattrs names+values, which by default is 64K. And since ceph reports 4M as the blocksize (the default ceph object size), generic/486 will fail in this filesystem because it will end up using XATTR_SIZE_MAX to set the size of the 2nd (big) xattr value. The fix is to adjust the max size in attr_replace_test so that it takes into account the initial xattr name and value lengths. Signed-off-by: Luís Henriques --- src/attr_replace_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/attr_replace_test.c b/src/attr_replace_test.c index cca8dcf8ff60..1c8d1049a1d8 100644 --- a/src/attr_replace_test.c +++ b/src/attr_replace_test.c @@ -29,6 +29,11 @@ int main(int argc, char *argv[]) char *value; struct stat sbuf; size_t size = sizeof(value); + /* + * Take into account the initial (small) xattr name and value sizes and + * subtract them from the XATTR_SIZE_MAX maximum. + */ + size_t maxsize = XATTR_SIZE_MAX - strlen(name) - 1; if (argc != 2) fail("Usage: %s \n", argv[0]); @@ -46,7 +51,7 @@ int main(int argc, char *argv[]) size = sbuf.st_blksize * 3 / 4; if (!size) fail("Invalid st_blksize(%ld)\n", sbuf.st_blksize); - size = MIN(size, XATTR_SIZE_MAX); + size = MIN(size, maxsize); value = malloc(size); if (!value) fail("Failed to allocate memory\n");