Received: by 2002:a05:6500:1b8a:b0:1ef:a0f1:aef6 with SMTP id df10csp45277lqb; Sun, 10 Mar 2024 04:35:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVXo1T9YLTfUv5yPS0/J83JOhTgtz+V+0cic6qLJD256nz+d/ZMDY9uxNqdbiICoQeS/eaTHQ7SVZPF0clg4XJtF9vj5RPbZEvznq8VxQ== X-Google-Smtp-Source: AGHT+IFzkB64IcuKwaDF0IEThL6+1V6ENmYNyxztLWjCrFv0BPvIv4hhn25Ue9RQNM0p7N8yPHAd X-Received: by 2002:a05:6a00:6ca1:b0:6e6:7af6:2201 with SMTP id jc33-20020a056a006ca100b006e67af62201mr3761610pfb.8.1710070505735; Sun, 10 Mar 2024 04:35:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710070505; cv=pass; d=google.com; s=arc-20160816; b=Ato44eFW+N/F3z9ckC1bxv23bJHDWnwghH+AkWijt0aNraL35npZ4uNN52h6w/ewnl mQsMnRuL5YPZ5y4VKdXrPlRKfu0xItt+RLLCKgvO1mIUTPic7ES1fCas72d9XDVL+vOJ SQDVlh/mN+gt9mQzMkDDj1b5jZLL0h2w14HYumUTW6lTcUKOsFqCB9m2qpuOS5l15HDi Z8tK9yt67pOUrNn3h58g8QmkI//eZkydOTsEXQUtQBdfO49UlHLZFusZv8JJ8qbC9/bb 5jSoc646WTIw13mGicYVidOfsE7vFU3SaingH4M8uoDZ6fMLMpyv3bk+psgw8jy28f+M PekQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GaiO0C8mYYe8UPwH7VfGhizM9IkvcDd4DEIbp78MQsg=; fh=NoockM32DYK4kKmGB6FrLr3wu/eNy9wy3+M+2sPPuZ4=; b=I0Ae8S2J5/g1EbNTmyc8IxY36e+4TZNkB+B/8CDLp86ahCRIphmRIlM8RcKEGNLsaS coltLajc6JvtmLC2qVWM1pw0RWludSMlGOdrqMaP8zeGXsa7qO+ccEYoMYaaeWqizhjR tju3GBRp9NIjUg66Fic0rMJmEh0AyTM9WFGHQnohX95BLWPNl65Wo1L+zzadKI6ZQNwZ veNdar1wCGKMY9spbC5s6B2Pc0QdUWtv4FLgQq2jTJpZ37EckX1tawxHEP0J/XtvY2vf doEZOUhvEnJGMQ6EkwUdRhqq69HjoyIgWymiXdwFUNB9TtOjMTbQnFXggHLVTTWkkcuZ 1K1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c6BFQ4NY; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-98197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a3-20020a636603000000b005dc34c3db42si2923504pgc.259.2024.03.10.04.35.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 04:35:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c6BFQ4NY; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-98197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98197-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 67DFF281957 for ; Sun, 10 Mar 2024 11:35:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E0B9208C4; Sun, 10 Mar 2024 11:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="c6BFQ4NY" 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 C5085200BA for ; Sun, 10 Mar 2024 11:34:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710070496; cv=none; b=XcqWIARkowleJu7530ki8VLdUGuCr9yQvVlNXnSTdA9Iy8OW5l1lX/PXl46YCmTikqqvbjjg30ZSIibEYwRGXYbjKSN5nFS4z7oYmTKYuhT4RHxMOHWurn2km8BPFfh9lp9auQ7AyavCmNroN32wJ4RMvkLTwr4SDGHHwF21Av0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710070496; c=relaxed/simple; bh=8U0c7cbI9cs2KewS+BWAmt6+dSM6QjbEQ8wwfbMe/w8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p2gxCGW+gnT/VJDMdEE0+V4AQDMDB1G5Hlwpe4w88S2wqg5dKbbd+ACHlBoIgqS78kJ8MqEiLezc/ytTTe8wgjQ+VxzQc2498GgVlzvq+aqbtBiAcJ5V6YonD1q8LrJ7JDvAA2zk/NBr82x6Ir5nyimvYNh5UjzQbmpLv8ZGBVU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=c6BFQ4NY; arc=none smtp.client-ip=170.10.129.124 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=1710070493; h=from:from:reply-to:subject:subject: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=GaiO0C8mYYe8UPwH7VfGhizM9IkvcDd4DEIbp78MQsg=; b=c6BFQ4NYrAfm4BUKrp5WnKSESruKFQwyLXl+sckWVQX6zBWGwiorHF69I/5Vx1DTtOKwiR nBsFMXx5fN8H2uuZrcRNpEaMogZbLk72tPqFJRIxUYRkT8Fjbv+9w9aBpodyiLMjSF2QZH U6QqA/IzdeL6r1g09HCkk2gUsrNgxA8= 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-513-eTMzwx4GNHuQ_9e0j9R40Q-1; Sun, 10 Mar 2024 07:34:48 -0400 X-MC-Unique: eTMzwx4GNHuQ_9e0j9R40Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 2FA05101A58D; Sun, 10 Mar 2024 11:34:47 +0000 (UTC) Received: from fedora (unknown [10.72.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E797C041EF; Sun, 10 Mar 2024 11:34:40 +0000 (UTC) Date: Sun, 10 Mar 2024 19:34:36 +0800 From: Ming Lei To: Patrick Plenefisch Cc: Mike Snitzer , Goffredo Baroncelli , linux-kernel@vger.kernel.org, Alasdair Kergon , Mikulas Patocka , Chris Mason , Josef Bacik , David Sterba , regressions@lists.linux.dev, dm-devel@lists.linux.dev, linux-btrfs@vger.kernel.org, ming.lei@redhat.com Subject: Re: LVM-on-LVM: error while submitting device barriers Message-ID: References: <672e88f2-8ac3-45fe-a2e9-730800017f53@libero.it> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 On Sat, Mar 09, 2024 at 03:39:02PM -0500, Patrick Plenefisch wrote: > On Wed, Mar 6, 2024 at 11:00 AM Ming Lei wrote: > > > > On Tue, Mar 05, 2024 at 12:45:13PM -0500, Mike Snitzer wrote: > > > On Thu, Feb 29 2024 at 5:05P -0500, > > > Goffredo Baroncelli wrote: > > > > > > > On 29/02/2024 21.22, Patrick Plenefisch wrote: > > > > > On Thu, Feb 29, 2024 at 2:56 PM Goffredo Baroncelli wrote: > > > > > > > > > > > > > Your understanding is correct. The only thing that comes to my mind to > > > > > > > cause the problem is asymmetry of the SATA devices. I have one 8TB > > > > > > > device, plus a 1.5TB, 3TB, and 3TB drives. Doing math on the actual > > > > > > > extents, lowerVG/single spans (3TB+3TB), and > > > > > > > lowerVG/lvmPool/lvm/brokenDisk spans (3TB+1.5TB). Both obviously have > > > > > > > the other leg of raid1 on the 8TB drive, but my thought was that the > > > > > > > jump across the 1.5+3TB drive gap was at least "interesting" > > > > > > > > > > > > > > > > > > what about lowerVG/works ? > > > > > > > > > > > > > > > > That one is only on two disks, it doesn't span any gaps > > > > > > > > Sorry, but re-reading the original email I found something that I missed before: > > > > > > > > > BTRFS error (device dm-75): bdev /dev/mapper/lvm-brokenDisk errs: wr > > > > > 0, rd 0, flush 1, corrupt 0, gen 0 > > > > > BTRFS warning (device dm-75): chunk 13631488 missing 1 devices, max > > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > tolerance is 0 for writable mount > > > > > BTRFS: error (device dm-75) in write_all_supers:4379: errno=-5 IO > > > > > failure (errors while submitting device barriers.) > > > > > > > > Looking at the code, it seems that if a FLUSH commands fails, btrfs > > > > considers that the disk is missing. The it cannot mount RW the device. > > > > > > > > I would investigate with the LVM developers, if it properly passes > > > > the flush/barrier command through all the layers, when we have an > > > > lvm over lvm (raid1). The fact that the lvm is a raid1, is important because > > > > a flush command to be honored has to be honored by all the > > > > devices involved. > > > > Hello Patrick & Goffredo, > > > > I can trigger this kind of btrfs complaint by simulating one FLUSH failure. > > > > If you can reproduce this issue easily, please collect log by the > > following bpftrace script, which may show where the flush failure is, > > and maybe it can help to narrow down the issue in the whole stack. > > > > > > #!/usr/bin/bpftrace > > > > #ifndef BPFTRACE_HAVE_BTF > > #include > > #endif > > > > kprobe:submit_bio_noacct, > > kprobe:submit_bio > > / (((struct bio *)arg0)->bi_opf & (1 << __REQ_PREFLUSH)) != 0 / > > { > > $bio = (struct bio *)arg0; > > @submit_stack[arg0] = kstack; > > @tracked[arg0] = 1; > > } > > > > kprobe:bio_endio > > /@tracked[arg0] != 0/ > > { > > $bio = (struct bio *)arg0; > > > > if (($bio->bi_flags & (1 << BIO_CHAIN)) && $bio->__bi_remaining.counter > 1) { > > return; > > } > > > > if ($bio->bi_status != 0) { > > printf("dev %s bio failed %d, submitter %s completion %s\n", > > $bio->bi_bdev->bd_disk->disk_name, > > $bio->bi_status, @submit_stack[arg0], kstack); > > } > > delete(@submit_stack[arg0]); > > delete(@tracked[arg0]); > > } > > > > END { > > clear(@submit_stack); > > clear(@tracked); > > } > > > > Attaching 4 probes... > dev dm-77 bio failed 10, submitter > submit_bio_noacct+5 > __send_duplicate_bios+358 > __send_empty_flush+179 > dm_submit_bio+857 > __submit_bio+132 > submit_bio_noacct_nocheck+345 > write_all_supers+1718 > btrfs_commit_transaction+2342 > transaction_kthread+345 > kthread+229 > ret_from_fork+49 > ret_from_fork_asm+27 > completion > bio_endio+5 > dm_submit_bio+955 > __submit_bio+132 > submit_bio_noacct_nocheck+345 > write_all_supers+1718 > btrfs_commit_transaction+2342 > transaction_kthread+345 > kthread+229 > ret_from_fork+49 > ret_from_fork_asm+27 > > dev dm-86 bio failed 10, submitter > submit_bio_noacct+5 > write_all_supers+1718 > btrfs_commit_transaction+2342 > transaction_kthread+345 > kthread+229 > ret_from_fork+49 > ret_from_fork_asm+27 > completion > bio_endio+5 > clone_endio+295 > clone_endio+295 > process_one_work+369 > worker_thread+635 > kthread+229 > ret_from_fork+49 > ret_from_fork_asm+27 > > > For context, dm-86 is /dev/lvm/brokenDisk and dm-77 is /dev/lowerVG/lvmPool io_status is 10(BLK_STS_IOERR), which is produced in submission code path on /dev/dm-77(/dev/lowerVG/lvmPool) first, so looks it is one device mapper issue. The error should be from the following code only: static void __map_bio(struct bio *clone) ... if (r == DM_MAPIO_KILL) dm_io_dec_pending(io, BLK_STS_IOERR); else dm_io_dec_pending(io, BLK_STS_DM_REQUEUE); break; Patrick, you mentioned lvmPool is raid1, can you explain how lvmPool is built? It is dm-raid1 target or over plain raid1 device which is build over /dev/lowerVG? Mike, the logic in the following code doesn't change from v5.18-rc2 to v5.19, but I still can't understand why STS_IOERR is set in dm_io_complete() in case of BLK_STS_DM_REQUEUE && !__noflush_suspending(), since DMF_NOFLUSH_SUSPENDING is only set in __dm_suspend() which is supposed to not happen in Patrick's case. dm_io_complete() ... if (io->status == BLK_STS_DM_REQUEUE) { unsigned long flags; /* * Target requested pushing back the I/O. */ spin_lock_irqsave(&md->deferred_lock, flags); if (__noflush_suspending(md) && !WARN_ON_ONCE(dm_is_zone_write(md, bio))) { /* NOTE early return due to BLK_STS_DM_REQUEUE below */ bio_list_add_head(&md->deferred, bio); } else { /* * noflush suspend was interrupted or this is * a write to a zoned target. */ io->status = BLK_STS_IOERR; } spin_unlock_irqrestore(&md->deferred_lock, flags); } thanks, Ming