Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp396373lql; Mon, 11 Mar 2024 06:13:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXb0Gu4NXr+95WGw9tz4AxR0Zdd2wKMBHEzU3x0ub4kNEiWg1a3dLr3O+n0wVZoQDx+baTgkJey3y7Nlj7jnELF80JxxEVfymdQHND02w== X-Google-Smtp-Source: AGHT+IEo240Wryr4ANjd2jF65Q2fQFLvbrFjMWDF1/1cDCoTm/nCBWToafzK5GoUQEuyR1BFrxHZ X-Received: by 2002:a05:6808:3c46:b0:3c2:1668:fdf5 with SMTP id gl6-20020a0568083c4600b003c21668fdf5mr9123631oib.10.1710162839516; Mon, 11 Mar 2024 06:13:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710162839; cv=pass; d=google.com; s=arc-20160816; b=QzUBHdtWlUq0R1CvaKfKMQAc05blWGNAZsCXymUhVMNcmpBcVv3ZNHXfdKuAVBBOuN ZH53tmPkP+cpFbgTtDA3cYrjO9CAkmmGDNkIWEyJu22RetWLNGak/s9hxh4q85UTyUTN NVYTfFj067NUtaR5zKTlNkFnkiBSBiNVXTJyR7KwcGHqrPF2gls7dMV9fg1ikUzg19qw zDFknr+4u1QTw/zIJ7XqIrokSlSfGelSMy2Tq1cUC55MnnWm71QYiNlxpL01E0MhmSa3 9wOPDwTo4GLtGv+osiSN7bHm73Ae+vvmcf2HCK6mBHd68GIYwq56TGtd/XGOa3Tgubyh /d6g== 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=SF+hHbhR6PmZRbNnvRDOIoP+U+GWHfuAJbw7MsIUXN0=; fh=NoockM32DYK4kKmGB6FrLr3wu/eNy9wy3+M+2sPPuZ4=; b=gUh710jdr7MGsTTy1BfiOPL5zGh9lmfIlHAjjPAkoS/TREsunRz/S5jWvJySDUHS4e KfpwnXDyZEF2jKt6K9kOY19EcqUKtrzlS+J5pxv4S02hoIKDYzqOtkg7CZB8X9dQBXt+ Iz7npc5ulJZzg/wOx4lr2I3KdecKsXIQgp7cZs1HbnqO9Tu11uB47YoxKIaUQX9DiAkS E2SaiLGwvojm1SJsZFFze5QRipWt2L8q00jF3lN7bq5MtqMlnuL3QKvdrIkkzsqT+uCx d9/ZAGpJOfH5+u6FbpsIn07vbV31Dq2naOc52d5xDm0cLOt7uByAsIp2mTX4irMUChIH JtOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RzAF3VmN; 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-98856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o25-20020a637e59000000b005e47d608cbesi4732233pgn.134.2024.03.11.06.13.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 06:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RzAF3VmN; 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-98856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98856-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C12C0B20DF5 for ; Mon, 11 Mar 2024 13:13:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CFBB3E47E; Mon, 11 Mar 2024 13:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RzAF3VmN" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 2DE803D0C6 for ; Mon, 11 Mar 2024 13:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710162806; cv=none; b=dk5zdQQgbw961T5z5CQF9UQ/XmEX5SEntpe4nWrCYNb67r+l8Y6orZwO89sARsT+AUTriefLNJELNUR7dlYc8PXX7t3DO7/+jkGaKq3bwPh7uXBXtv7pA+aWe3MqKRJXg5LZunfR6djDGxe+Xs+w6yPONv5pRN++HxEmPhIAieg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710162806; c=relaxed/simple; bh=oklUwL+uJA6fNtuusqrKD0mu1H8aZpzPS0lrskntuAA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=edhxYz+UjMwu9IBXWJEUXb2Snkz8+XtQVT0QAgAcM25UIFSjcoVVQTsevcSg6AdB6QSFGlPOsLQUt4ZS6sGhCAXjTvlAsTbp7T68K18ocYbrteY4H+cMs0HxwFAu6EmC7qGT02Qb9WXXo6TPpm0hjZzExzY/s6++Tm0Zm4Dw0W4= 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=RzAF3VmN; arc=none smtp.client-ip=170.10.133.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=1710162803; 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=SF+hHbhR6PmZRbNnvRDOIoP+U+GWHfuAJbw7MsIUXN0=; b=RzAF3VmNC8pdD51JRqQpFVROoKWgsgL43TW3xnvLJmXxTN0fBK7Olr/Abhsy2FObXnIZiW JWbMMS+ddX+oU5EJbN7AmxYtGHysfKB0r4RA3HwNCFAFdtlGigjOu1jgNcQ68sW/z7ThL2 1VwEz0JZnHQ0h9eik+p0ZOoF6KxL/5A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-182-Udhoi6WwMIqlcHlVxvW-Ng-1; Mon, 11 Mar 2024 09:13:20 -0400 X-MC-Unique: Udhoi6WwMIqlcHlVxvW-Ng-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 5ED1538000B0; Mon, 11 Mar 2024 13:13:19 +0000 (UTC) Received: from fedora (unknown [10.72.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A3C7C04125; Mon, 11 Mar 2024 13:13:12 +0000 (UTC) Date: Mon, 11 Mar 2024 21:13:08 +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: 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 Sun, Mar 10, 2024 at 02:11:11PM -0400, Patrick Plenefisch wrote: > On Sun, Mar 10, 2024 at 11:27 AM Mike Snitzer wrote: > > > > On Sun, Mar 10 2024 at 7:34P -0400, > > Ming Lei wrote: > > > > > 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: > > > > > > > > > > #!/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; > > > > I agree that the above bpf stack traces for dm-77 indicate that > > dm_submit_bio failed, which would end up in the above branch if the > > target's ->map() returned DM_MAPIO_KILL or DM_MAPIO_REQUEUE. > > > > But such an early failure speaks to the flush bio never being > > submitted to the underlying storage. No? > > > > dm-raid.c:raid_map does return DM_MAPIO_REQUEUE with: > > > > /* > > * If we're reshaping to add disk(s)), ti->len and > > * mddev->array_sectors will differ during the process > > * (ti->len > mddev->array_sectors), so we have to requeue > > * bios with addresses > mddev->array_sectors here or > > * there will occur accesses past EOD of the component > > * data images thus erroring the raid set. > > */ > > if (unlikely(bio_end_sector(bio) > mddev->array_sectors)) > > return DM_MAPIO_REQUEUE; > > > > But a flush doesn't have an end_sector (it'd be 0 afaik).. so it seems > > weird relative to a flush. > > > > > 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? > > LVM raid1: > lvcreate --type raid1 -m 1 ... OK, that is the reason, as Mike mentioned. dm-raid.c:raid_map returns DM_MAPIO_REQUEUE, which is translated into BLK_STS_IOERR in dm_io_complete(). Empty flush bio is sent from btrfs, both .bi_size and .bi_sector are set as zero, but the top dm is linear, which(linear_map()) maps new bio->bi_iter.bi_sector, and the mapped bio is sent to dm-raid(raid_map()), then DM_MAPIO_REQUEUE is returned. The one-line patch I sent in last email should solve this issue. https://lore.kernel.org/dm-devel/a783e5ed-db56-4100-956a-353170b1b7ed@inwind.it/T/#m8fce3ecb2f98370b7d7ce8db6714bbf644af5459 But DM_MAPIO_REQUEUE misuse needs close look, and I believe Mike is working on that bigger problem. I guess most of dm targets don't deal with empty bio well, at least linear & dm-raid, not look into others yet, :-( Thanks, Ming