From patchwork Tue Jun 7 16:51:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 579485 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 59E0CC43334 for ; Tue, 7 Jun 2022 16:51:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345160AbiFGQvS (ORCPT ); Tue, 7 Jun 2022 12:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235555AbiFGQvQ (ORCPT ); Tue, 7 Jun 2022 12:51:16 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 876A1F5D37; Tue, 7 Jun 2022 09:51:15 -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 4860D1F989; Tue, 7 Jun 2022 16:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1654620674; 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=shFOWPg68Uwfa4tVZjUM5dOMRJq90YtpwIjmrRmGpPo=; b=t1ojOnn5jcQS5iyPgsK2IgVRD06NDn8Wlx1oeTZQJU3wW6SCcoUz9SpdjTYzCa8T7oUYPC Mih6orQFPbLub+mVZApYXc/yy+tC7ThwsPrhBbteYZ1mRh0ri9kkp+G7CXWWT4n/fy9YTu 3Lz3/y1KxRMr2dhXJUn/Zj5WzhwubkI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1654620674; 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=shFOWPg68Uwfa4tVZjUM5dOMRJq90YtpwIjmrRmGpPo=; b=c0iiTrFjea4UEkWLV5XzqMPf2suuifZc87N0BX4XGZcA1rMhuk94r8xipLoMWRkkFXV/wU fqda68qOMDVWNyBA== 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 CACFB13638; Tue, 7 Jun 2022 16:51:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ikBFLgGCn2J6BAAAMHmgww (envelope-from ); Tue, 07 Jun 2022 16:51:13 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id 4e2cb5fe; Tue, 7 Jun 2022 16:51:54 +0000 (UTC) From: =?utf-8?q?Lu=C3=ADs_Henriques?= To: fstests@vger.kernel.org, "Darrick J. Wong" Cc: Jeff Layton , Xiubo Li , ceph-devel@vger.kernel.org, =?utf-8?q?Lu=C3=ADs_Henriques?= Subject: [PATCH v2] src/attr_replace_test: dynamically adjust the max xattr size Date: Tue, 7 Jun 2022 17:51:53 +0100 Message-Id: <20220607165153.27797-1-lhenriques@suse.de> In-Reply-To: <87wnds8mxv.fsf@brahms.olymp> References: <87wnds8mxv.fsf@brahms.olymp> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org CephFS doesn't had a maximum xattr size. Instead, it imposes a maximum size for the full set of xattrs names+values, which by default is 64K but may be changed. Test generic/486 started to fail after fixing a ceph bug where this limit wasn't being imposed. Adjust dynamically the size of the xattr being set if the error returned is -ENOSPC. Signed-off-by: Luís Henriques --- src/attr_replace_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/attr_replace_test.c b/src/attr_replace_test.c index cca8dcf8ff60..d1b92703ba2a 100644 --- a/src/attr_replace_test.c +++ b/src/attr_replace_test.c @@ -62,7 +62,10 @@ int main(int argc, char *argv[]) /* Then, replace it with bigger one, forcing short form to leaf conversion. */ memset(value, '1', size); - ret = fsetxattr(fd, name, value, size, XATTR_REPLACE); + do { + ret = fsetxattr(fd, name, value, size, XATTR_REPLACE); + size -= 256; + } while ((ret < 0) && (errno == ENOSPC) && (size > 256)); if (ret < 0) die(); close(fd);