Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp492028rdb; Mon, 15 Jan 2024 04:14:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFltuzzFujm3HCeUwwt14zvIO+J3wRn8bVpso9dzl9CR10jutmP6u3mRJ3zynKxQuBmOVVB X-Received: by 2002:a05:6a00:a1b:b0:6d9:bd62:bf8a with SMTP id p27-20020a056a000a1b00b006d9bd62bf8amr3023429pfh.68.1705320853388; Mon, 15 Jan 2024 04:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705320853; cv=none; d=google.com; s=arc-20160816; b=UPTzPf1gfLLXcZ+8VQ9wTEZcYz6/adIjt6oXpCi7fhDwnm82Ak/6IF5WphsM0DukkV ss5p24aOs/6vIR1+O6YzjyOzU0t8l0Rfd6fYLeZiQxOzXi6nvUmAdIW+ZxcxFrGQAhdx 1nOxTXnfones84lZjYKemoOp4MPw695ckvMpVWLIcftvJNPQ5DnIJxaKKHFmb6UtAdNb r+G7KBM/GNtssrtC8c6Gfih7sH1u+9LEb5HLp1sag2ZEUJy5WcOn2lDk4Cl6OD+Dm6Z8 h4bGFQ3Qw0309iPdGLd0r7nu41ehJMZ79A4ZcHUbwfp0hwynpdHvlWhyStm0zIqlfOsz ClmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=bi/+hjm70dF+v6Ck313AZEC8H6HbDz/E+16W339tXNc=; fh=U6qESr3YDTmJuMlt+euDiZ+BZoGpuNj7P7BgvNvqQxo=; b=XSrfmAi69bqclmQAp6Mw5I7FuCMwglK8IQ38Pi31HNYVbfmgr6u5JFSt6W2vsATrp9 NpFSQR7NNXIi47ga+sGbzp0UhBIVz1WrI+ips7m2Nx5V7FF6V3twezXzdD5CUnxtIKPh tBenyd1J7cZwO62b3l+88tjAAr95NUG7R80psA2XFwjKUHNWVeZnMXd61QyYBp5ml7Tr EgkkMU/7T969NU11PEpnnqF5pS0EIY0MB1bTaTlqbdi0I2AkeGDAtdlE/HN4uVMPRu0d O74G/T2SCQDf39RbgxspHqf6js/v5SAsgrmr5lsgX28j/5ZS12eAu6w1NDyyyp4F7hAY wecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=C1RAle4o; spf=pass (google.com: domain of linux-kernel+bounces-25955-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f7-20020a056a00238700b006d9ab8c2a93si9018640pfc.56.2024.01.15.04.14.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 04:14:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25955-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=C1RAle4o; spf=pass (google.com: domain of linux-kernel+bounces-25955-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F0C0281EC9 for ; Mon, 15 Jan 2024 12:14:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC3F42C69F; Mon, 15 Jan 2024 12:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C1RAle4o" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CB402C695 for ; Mon, 15 Jan 2024 12:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705320842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=eY9sAlKGBP15WtJLvXPjMLCZS+l6QaLo35obeFomqdM=; b=C1RAle4olfOIAafJ4egeRo7iP5iBrPXMuQzRwwXRigbtaU2WWRUPNzN9l7E62qV99j9dji y/sC9JWb94OAi5UNyADBUknNHjbc86B+FJ49MWLhINCAXxowDXwrFL+QFcuPwr+yYOmkGV PGbgwNgbQ2/ALCOCHnKTlMfDl0yJmnc= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-xj_nQZS7Pf63chvndXN5Yw-1; Mon, 15 Jan 2024 07:14:00 -0500 X-MC-Unique: xj_nQZS7Pf63chvndXN5Yw-1 Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-3bbbfb0f038so10940108b6e.3 for ; Mon, 15 Jan 2024 04:14:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705320840; x=1705925640; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eY9sAlKGBP15WtJLvXPjMLCZS+l6QaLo35obeFomqdM=; b=NA9vcLZX36uSMZnjcK28WY7NJwh5KamxxZ0fa4QGTD8Use28o/hopyeuwbX+/QM0De oEz2/4LjAekcDtUHvf+pn4RcJmGCILKATmoNrMVyGoCiKEIv9mTVxOs9dyIJLON0dCRS 3A6QnNgcNWOreoZGkCjuradBt8569rMAbFczTFiQ8f0UXvE3mQmZTt21qIcZntV98/eG ArHahkthYp5+LQ+KVGpjYLBTUjgZHTKXoT1df70zeGmh/r99YROEOY+Zt9ocPZhImBIK BKOCK+Y7kgQxbnmFbVjnwigFIU2ubJ2JKqXZmyL/6zzI6tcOi+4e1h6LDzvwWZLUBhL4 9VBg== X-Gm-Message-State: AOJu0Yx0DIdek2yOyQNw5m0DTrAGbaAufKemtXBfUVUXsE9NP9mp4wXG /elvavUJaATS4j30tnxWTHX9JUN5a5hVo8o1eQLy+fz8qcvl8gVhf9CGu2YeoFuHAvbCKEOKUJk BqXCLROrHAaE6q2dG0EDsBQhhK+Ai9wfJsmtI0Nv26vOWhxONQjgc8CJyvv2lVA== X-Received: by 2002:a05:6808:9b0:b0:3bd:4d3c:ff9c with SMTP id e16-20020a05680809b000b003bd4d3cff9cmr5899449oig.116.1705320840038; Mon, 15 Jan 2024 04:14:00 -0800 (PST) X-Received: by 2002:a05:6808:9b0:b0:3bd:4d3c:ff9c with SMTP id e16-20020a05680809b000b003bd4d3cff9cmr5899442oig.116.1705320839720; Mon, 15 Jan 2024 04:13:59 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Allison Karlitskaya Date: Mon, 15 Jan 2024 13:13:49 +0100 Message-ID: Subject: PROBLEM: BLKPG_DEL_PARTITION with GENHD_FL_NO_PART used to return ENXIO, now returns EINVAL To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Content-Type: text/plain; charset="UTF-8" hi, [1.] One line summary of the problem: BLKPG_DEL_PARTITION on an empty loopback device used to return ENXIO but now returns EINVAL, breaking partprobe [2.] Full description of the problem/report: We recently caught this problem in our CI for Cockpit: https://github.com/cockpit-project/bots/pull/5793 The summary is that if you do something like this: $ dd if=/dev/zero of=/tmp/foo bs=1M count=50 $ partprobe $(losetup --find --show /tmp/foo) Then this will fail with the following error message: Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/loop2 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. .. when it used to be successful. That's down to this syscall (called by partprobe) changing its behaviour between kernel versions: -ioctl(3, BLKPG, {op=BLKPG_DEL_PARTITION, flags=0, datalen=152, data={start=0, length=0, pno=1, devname="", volname=""}}) = -1 ENXIO (No such device or address) +ioctl(3, BLKPG, {op=BLKPG_DEL_PARTITION, flags=0, datalen=152, data={start=0, length=0, pno=1, devname="", volname=""}}) = -1 EINVAL (Invalid argument) This is observed on Ubuntu jammy with partprobe from parted 3.4-2build1. I've confirmed that the original parted-3.4 download from https://ftp.gnu.org/gnu/parted/ is also impacted in the same way. [3.] Keywords: block, partition, BLKPG_DEL_PARTITION, loop device, EINVAL, ENXIO [4.] Kernel information: Linux ubuntu 5.15.0-94-generic #104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux This is the version currently in jammy-proposed. The likely culprit is this commit: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy/commit/?id=49a502554e8aa853a0357f287121d4cdf4442a58 which is also upstream as 1a721de8489fa559ff4471f73c58bb74ac5580d3. There has been discussion on linux-kernel before about this: https://marc.info/?l=linux-kernel&m=169753467305218&w=2 but now we have a pretty clear case of "breaks userspace in the wild". [4.1.] Kernel version (from /proc/version): Linux version 5.15.0-94-generic (buildd@lcy02-amd64-096) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024 [4.2.] Kernel .config file: I pasted a copy here: https://paste.centos.org/view/8d6506bc but it won't be around for more than 24 hours. It's just the config file present in /boot on the affected install. [5.] Most recent kernel version which did not have the bug: We last tested 5.15.0-91-generic and found it to be working with the previous behaviour (ie: returning ENXIO). [7.] A small shell script or example program which triggers the problem (if possible) as above: $ dd if=/dev/zero of=/tmp/foo bs=1M count=50 $ partprobe $(losetup --find --show /tmp/foo) [8.] Environment [8.1.] Software (add the output of the ver_linux script here) [8.2.] Processor information (from /proc/cpuinfo): [8.3.] Module information (from /proc/modules): [8.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem) [8.5.] PCI information ('lspci -vvv' as root) [8.6.] SCSI information (from /proc/scsi/scsi) [8.7.] Other information that might be relevant to the problem (please look in /proc and include all information that you think to be relevant): [X.] Other notes, patches, fixes, workarounds: I don't expect there would be anything relevant here, but feel free to ask. It's a qemu x86_64 VM image running on my Intel laptop. If you want to test this, check out https://github.com/cockpit-project/bots/tree/image-refresh-ubuntu-2204-20240114-225118 and run ./vm-run -q ubuntu-2204 at which point you should be presented with instructions about how to ssh to the machine. Thanks for the attention! Allison Karlitskaya