From patchwork Wed Apr 6 11:08:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1613911 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=qqgmWbSY; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XlpaWJLV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KYMFt6v6xz9sFq for ; Wed, 6 Apr 2022 21:08:49 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 380993CA469 for ; Wed, 6 Apr 2022 13:08:42 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 41F8C3C1BBE for ; Wed, 6 Apr 2022 13:08:40 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 in-6.smtp.seeweb.it (Postfix) with ESMTPS id 748741400991 for ; Wed, 6 Apr 2022 13:08:39 +0200 (CEST) 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 55BA81F7AD for ; Wed, 6 Apr 2022 11:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649243318; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZErBS0p7qIT+gIoWHbmea4e3jOx4n5lnrGEMpcYRohM=; b=qqgmWbSYS5uYC7ne4H96J8jJRGtJ+4VMqk2T7zdntKMtDsQN8JdfG9TfOIpemThjE7TdTP 0Tj1qWKaX5xAfynYiJJCwabDUJU6rMZ6wb/EvComnNvEJbnElcd9EwuinoKhUEuFiKNWSn MKsY+IuLObAxbQtzkOTxcgxfQAso/BU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649243318; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZErBS0p7qIT+gIoWHbmea4e3jOx4n5lnrGEMpcYRohM=; b=XlpaWJLVK7A/28wLV8A3rgaGEFO5X9uDyLEuZ7wmxBn2wyrRj3FRtkLV+WJTVyNLC71EMr AoqA8r/UV8yLDfDQ== 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 43323139F5 for ; Wed, 6 Apr 2022 11:08:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CHhMD7Z0TWJ9OQAAMHmgww (envelope-from ) for ; Wed, 06 Apr 2022 11:08:38 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Wed, 6 Apr 2022 13:08:37 +0200 Message-Id: <20220406110837.14773-1-mdoucha@suse.cz> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH] syscalls: Check for leftover partition info in loopdev ioctl tests X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Due to a kernel bug, successful ioctl09 and ioctl_loop01 test runs sometimes leave behind stale partition info on the loop device they used, which then causes mkfs.vfat to fail in later tests. Check that partition info was properly removed in cleanup. Signed-off-by: Martin Doucha Reviewed-by: Petr Vorel --- This does not fix the mkfs.vfat failures but it makes the true cause visible. We could add a workaround for the mkfs.vfat failures by simply initializing the loop device with the LO_FLAGS_PARTSCAN flag by default, or at least when stale partition info is found by tst_find_free_loopdev(). testcases/kernel/syscalls/ioctl/ioctl09.c | 12 +++++++++++- testcases/kernel/syscalls/ioctl/ioctl_loop01.c | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/ioctl/ioctl09.c b/testcases/kernel/syscalls/ioctl/ioctl09.c index 9728ecb9c..09867a5c5 100644 --- a/testcases/kernel/syscalls/ioctl/ioctl09.c +++ b/testcases/kernel/syscalls/ioctl/ioctl09.c @@ -19,7 +19,7 @@ ({ value ? TST_RETVAL_EQ0(x) : TST_RETVAL_NOTNULL(x); }) static char dev_path[1024]; -static int dev_num, attach_flag, dev_fd; +static int dev_num = -1, attach_flag, dev_fd; static char loop_partpath[1026], sys_loop_partpath[1026]; static void change_partition(const char *const cmd[]) @@ -102,6 +102,16 @@ static void cleanup(void) SAFE_CLOSE(dev_fd); if (attach_flag) tst_detach_device(dev_path); + + if (dev_num < 0) + return; + + sprintf(sys_loop_partpath, "/sys/block/loop%d/loop%dp1", dev_num, + dev_num); + sprintf(loop_partpath, "%sp1", dev_path); + + if (!access(sys_loop_partpath, F_OK) || !access(loop_partpath, F_OK)) + tst_res(TWARN, "Partition info was not cleared from loop dev"); } static struct tst_test test = { diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop01.c b/testcases/kernel/syscalls/ioctl/ioctl_loop01.c index 734d803d5..17168ae04 100644 --- a/testcases/kernel/syscalls/ioctl/ioctl_loop01.c +++ b/testcases/kernel/syscalls/ioctl/ioctl_loop01.c @@ -135,6 +135,12 @@ static void cleanup(void) SAFE_CLOSE(dev_fd); if (attach_flag) tst_detach_device(dev_path); + + if (!*sys_loop_partpath || !*loop_partpath) + return; + + if (!access(sys_loop_partpath, F_OK) || !access(loop_partpath, F_OK)) + tst_res(TWARN, "Partition info was not cleared from loop dev"); } static struct tst_test test = {