From patchwork Tue Dec 3 17:38:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Hung Tsai X-Patchwork-Id: 13892767 X-Patchwork-Delegate: snitzer@redhat.com 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 747B91F8AD2 for ; Tue, 3 Dec 2024 17:39:06 +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=1733247548; cv=none; b=LxSOYmnssBuoz18iEErEUzFA62Xz9cKsLwqLB6EyhYP/wWzU661ZFrTuKvG60nxFtrEgIV3j8QOkMGguIHmpCsmTJ6hC4G06LX7+KNhM8OCPgQE/v8Z5TwjdfTnMQE3wxXQeN1m6CczMoN8+NITxqIM03s02lQ7hk68SdXWpH98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733247548; c=relaxed/simple; bh=cnf4vNSINpKH8eXM2kpr7r2gin3qLFoBtzgS2hpkGoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=FwRIWB5UIzsT5xrXIEzfmTuv8sQdSYzP82xgPFbCp2MjokQiWOkyjFInybKJe5KZJLEPW143PgM4pv7PppHFHNifoz6YEJZLW6dysXuHazlIDULr2xgucJ7EJOtVszq8EK/0JsPOOxbXKVNkNB129y/veHKJJt+NGlM78YlFqEk= 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=RyXY6swt; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RyXY6swt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733247545; 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=PVZwHTojO+ZL0SimvTlVGTrW6hfMS7wtkNK0d6n7hvg=; b=RyXY6swtMckJQiH7mYjQSWiTt0aRT7DElZmqs4ikk+MRuMxmp2xyrRrtKk53k8sk1Kd1nP XhAbmn9IFg1pDBLaLejHF1pioAASysRvGrjyyt8YwW1fmvaxzdo+SUXGf6d/TlDWr6Yevv loYRnfFqvmdT23eiadXbBRfjag53SVw= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-8Mn_iC-qOVac0haezrmTpQ-1; Tue, 03 Dec 2024 12:39:03 -0500 X-MC-Unique: 8Mn_iC-qOVac0haezrmTpQ-1 X-Mimecast-MFC-AGG-ID: 8Mn_iC-qOVac0haezrmTpQ Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0988619560A2; Tue, 3 Dec 2024 17:39:03 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.67.24.41]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 708671956054; Tue, 3 Dec 2024 17:38:59 +0000 (UTC) From: Ming-Hung Tsai To: dm-devel@lists.linux.dev Cc: Mikulas Patocka , Joe Thornber , Heinz Mauelshagen , Mike Snitzer , Ming-Hung Tsai Subject: [PATCH 1/3] dm array: fix releasing a faulty array block twice in dm_array_cursor_end Date: Wed, 4 Dec 2024 01:38:49 +0800 Message-ID: <20241203173849.1258066-1-mtsai@redhat.com> In-Reply-To: <20241203173658.1257887-1-mtsai@redhat.com> References: <20241203173658.1257887-1-mtsai@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5qACcumsKOxSc5ke4nrZUJ89Orpb_SSCpmfW433WVPc_1733247543 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true When dm_bm_read_lock() fails due to locking or checksum errors, it releases the faulty block implicitly while leaving an invalid output pointer behind. The caller of dm_bm_read_lock() should not operate on this invalid dm_block pointer, or it will lead to undefined result. For example, the dm_array_cursor incorrectly caches the invalid pointer on reading a faulty array block, causing a double release in dm_array_cursor_end(), then hitting the BUG_ON in dm-bufio cache_put(). Reproduce steps: 1. initialize a cache device dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc $262144" dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1 dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \ /dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" 2. wipe the second array block offline dmsteup remove cache cmeta cdata corig mapping_root=$(dd if=/dev/sdc bs=1c count=8 skip=192 \ 2>/dev/null | hexdump -e '1/8 "%u\n"') ablock=$(dd if=/dev/sdc bs=1c count=8 skip=$((4096*mapping_root+2056)) \ 2>/dev/null | hexdump -e '1/8 "%u\n"') dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock 3. try reopen the cache device dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc $262144" dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \ /dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" Kernel logs: (snip) device-mapper: array: array_block_check failed: blocknr 0 != wanted 10 device-mapper: block manager: array validator check failed for block 10 device-mapper: array: get_ablock failed device-mapper: cache metadata: dm_array_cursor_next for mapping failed ------------[ cut here ]------------ kernel BUG at drivers/md/dm-bufio.c:638! Fix by setting the cached block pointer to NULL on errors. Signed-off-by: Ming-Hung Tsai Fixes: fdd1315aa5f0 ("dm array: introduce cursor api") --- drivers/md/persistent-data/dm-array.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index 157c9bd2fed7..c46a374f7459 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -917,23 +917,28 @@ static int load_ablock(struct dm_array_cursor *c) if (c->block) unlock_ablock(c->info, c->block); - c->block = NULL; - c->ab = NULL; c->index = 0; r = dm_btree_cursor_get_value(&c->cursor, &key, &value_le); if (r) { DMERR("dm_btree_cursor_get_value failed"); dm_btree_cursor_end(&c->cursor); + goto out; } else { r = get_ablock(c->info, le64_to_cpu(value_le), &c->block, &c->ab); if (r) { DMERR("get_ablock failed"); dm_btree_cursor_end(&c->cursor); + goto out; } } + return 0; + +out: + c->block = NULL; + c->ab = NULL; return r; } From patchwork Tue Dec 3 17:48:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Hung Tsai X-Patchwork-Id: 13892784 X-Patchwork-Delegate: snitzer@redhat.com 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 C372315E5B8 for ; Tue, 3 Dec 2024 17:49:13 +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=1733248157; cv=none; b=WuEfdXof9mt1lIVOdw+EVE3A3ApOkLyouWzpff2mQ4QnTCWw48B61/lKQ9Y8n2v6l37qpR0BoM42kbTxXoi7xg4iVU9Gr/cvKO+NdAY/Doe2VaJ4ME+o8EcpXv+KOxO51fUqw/PaLIPCC/ozss2Da9pmbGzPKAkQHA0LxqDqPDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733248157; c=relaxed/simple; bh=pnqZh8KhbzXOe03iO+I7zAzieNyrd8HjHjLkoZQkAwQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=b3CSn8zY8elLhXT+BrOk9DRSaJOr/lCiOaHxW7GPqdjJtDPkdCvqU3bp6NmIzQxfCykXaamC5+RsaSnJPsn6US4KinTAxZi1K0XUtx9AHy3KB7V/K4CKyV0kItycGjoqnP8SJdql1afkEq/ZZ5V0au5aGZzr3fI+Etk2Txp2trI= 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=i5v3oFMc; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i5v3oFMc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733248152; 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=WilombPjhCFfMtjBeUjA8yg0oZFVL0V/uUAxjGEBSR4=; b=i5v3oFMc2WfyStwewASqb3kaXTpWPeSc2MLGl5Xwqr7vpx2X7DvXUFTh8xLkkeh+r9OrHi mCyRo9MLsjcB8mtzWA2Z4So1V826das3KXlm9cqW8LvVBb40PwUWZfOSSHc2qm84GPORhS Orba3a5XQYmqaPunRHjwN460S29asho= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-7-NE8Bi7ZOM5Ci_OH-tOhzbA-1; Tue, 03 Dec 2024 12:49:11 -0500 X-MC-Unique: NE8Bi7ZOM5Ci_OH-tOhzbA-1 X-Mimecast-MFC-AGG-ID: NE8Bi7ZOM5Ci_OH-tOhzbA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D98AE1954AF2; Tue, 3 Dec 2024 17:49:10 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.67.24.41]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7161A30000DF; Tue, 3 Dec 2024 17:49:07 +0000 (UTC) From: Ming-Hung Tsai To: dm-devel@lists.linux.dev Cc: Mikulas Patocka , Joe Thornber , Heinz Mauelshagen , Mike Snitzer , Ming-Hung Tsai Subject: [PATCH 2/3] dm array: fix unreleased btree blocks on closing a faulty array cursor Date: Wed, 4 Dec 2024 01:48:57 +0800 Message-ID: <20241203174857.1259403-1-mtsai@redhat.com> In-Reply-To: <20241203173756.1257967-1-mtsai@redhat.com> References: <20241203173756.1257967-1-mtsai@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: QYd7fv2BXVq_j9mDNr_lEgi7Tzm3FME-dgklhc1BOHA_1733248151 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true The cached block pointer in dm_array_cursor might be NULL if it reaches an unreadable array block, or the array is empty. Therefore, dm_array_cursor_end() should call dm_btree_cursor_end() unconditionally, to prevent leaving unreleased btree blocks. Signed-off-by: Ming-Hung Tsai Fixes: fdd1315aa5f0 ("dm array: introduce cursor api") Reviewed-by: thornber@redhat.com --- drivers/md/persistent-data/dm-array.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index c46a374f7459..1c3af717ee4f 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -961,10 +961,10 @@ EXPORT_SYMBOL_GPL(dm_array_cursor_begin); void dm_array_cursor_end(struct dm_array_cursor *c) { - if (c->block) { + if (c->block) unlock_ablock(c->info, c->block); - dm_btree_cursor_end(&c->cursor); - } + + dm_btree_cursor_end(&c->cursor); } EXPORT_SYMBOL_GPL(dm_array_cursor_end); From patchwork Tue Dec 3 17:50:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Hung Tsai X-Patchwork-Id: 13892785 X-Patchwork-Delegate: snitzer@redhat.com 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 0E0841FC0E0 for ; Tue, 3 Dec 2024 17:50:42 +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=1733248244; cv=none; b=nQ0Jx8fZ5oRl60F7Wd3tvf/uKuDZWQAvCOqJMBNwUnX+pTMNMXjdHnee0pyNiaMBbBZ0ubOZwz2EMwDiF7XJflBCZF2maPeNj2rONFLQsqiS3GmFBSVbHm8d5DlV2cAPHMyizJM6PN2FdeY6LFtWGDpBYghvL7lmkFR6M4Ko1/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733248244; c=relaxed/simple; bh=zIUHK65kTEHSdpveWrss+ErYIWT+4juOjNkAEt3H8pM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=UogAGxmrgHTSA7xwwXatkMX2RbV43FqA3dyVyG/5G3msftciNIopic5atswnucK3cOCzLwmQJB/uJqlul3vzWnxL80RlBVKZ0mIfYRZ2gAbwPUSPpwSSiPUaOWUsrKCNwiJO2Jl1IonmPolwu9NjFlEDFWBtvW8lmH9kOI4lQj0= 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=LIWUKB2L; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LIWUKB2L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733248241; 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=HULijjWGV1+G9zVOYPCMw+7nNRhQ0FBn9s6ocOTMmuQ=; b=LIWUKB2Lw7eVB1A2o0LryeT+Kp41ORe0D4FYDRFkjIEFwgEZXJOQaAzlzqPx6vHPMpWvfF HlS+TelJDtKOAvIZaQ/wu9ktH91OVrhqk1D5I7gE/yEeucEYytS/2vCEITSgbfTVUFhxfZ 3O9xKatv/wCLM1ELdoQCvObOSAN+2gc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-388-d0TVMtRXNjGZ16s6wdHT0w-1; Tue, 03 Dec 2024 12:50:40 -0500 X-MC-Unique: d0TVMtRXNjGZ16s6wdHT0w-1 X-Mimecast-MFC-AGG-ID: d0TVMtRXNjGZ16s6wdHT0w Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8EB041955EB3; Tue, 3 Dec 2024 17:50:39 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.67.24.41]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1AD4F1955F2D; Tue, 3 Dec 2024 17:50:35 +0000 (UTC) From: Ming-Hung Tsai To: dm-devel@lists.linux.dev Cc: Mikulas Patocka , Joe Thornber , Heinz Mauelshagen , Mike Snitzer , Ming-Hung Tsai Subject: [PATCH 3/3] dm array: fix cursor index when skipping across block boundaries Date: Wed, 4 Dec 2024 01:50:29 +0800 Message-ID: <20241203175029.1259542-1-mtsai@redhat.com> In-Reply-To: <20241203173756.1257967-1-mtsai@redhat.com> References: <20241203173756.1257967-1-mtsai@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HVmu_dsFYEqv2-QE8QhoK-2Yo1VwP1cDD5OwV7p43_Y_1733248239 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true dm_array_cursor_skip() seeks to the target position by loading array blocks iteratively until the specified number of entries to skip is reached. When seeking across block boundaries, it uses dm_array_cursor_next() to step into the next block. dm_array_cursor_skip() must first move the cursor index to the end of the current block; otherwise, the cursor position could incorrectly remain in the same block, causing the actual number of skipped entries to be much smaller than expected. This bug affects cache resizing in v2 metadata and could lead to data loss if the fast device is shrunk during the first-time resume. For example: 1. create a cache metadata consists of 32768 blocks, with a dirty block assigned to the second bitmap block. cache_restore v1.0 is required. cat <> cmeta.xml EOF dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" cache_restore -i cmeta.xml -o /dev/mapper/cmeta --metadata-version=2 2. bring up the cache while attempt to discard all the blocks belonging to the second bitmap block (block# 32576 to 32767). The last command is expected to fail, but it actually succeeds. dmsetup create cdata --table "0 2084864 linear /dev/sdc 8192" dmsetup create corig --table "0 65536 linear /dev/sdc 2105344" dmsetup create cache --table "0 65536 cache /dev/mapper/cmeta \ /dev/mapper/cdata /dev/mapper/corig 64 2 metadata2 writeback smq \ 2 migration_threshold 0" Signed-off-by: Ming-Hung Tsai Fixes: 9b696229aa7d ("dm persistent data: add cursor skip functions to the cursor APIs") Reviewed-by: thornber@redhat.com --- drivers/md/persistent-data/dm-array.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index 1c3af717ee4f..b293da766fb1 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -1004,6 +1004,7 @@ int dm_array_cursor_skip(struct dm_array_cursor *c, uint32_t count) } count -= remaining; + c->index += (remaining - 1); r = dm_array_cursor_next(c); } while (!r);