From patchwork Thu Dec 5 11:41:51 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: 13895088 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 0AB12207E12 for ; Thu, 5 Dec 2024 11:42: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=1733398976; cv=none; b=XBpNIvMdL28FJ2DKJyFRzvgyBDzmbCTdgOO3RiOPlHS3aSY4UX/NFlwRyg4UUVAEcp27kV/cmmn9aYVO1p3USfFwaFoAng9FuV0iEpXkxwaPpTorznRJQnFwc5TXnDSd6TT3F3GnVos58YlvM2mjOb+EZF2+5VRhICUiJL0YjXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733398976; c=relaxed/simple; bh=xHuJ2Z2bSmCo0Hm1iTg1LQEKiRWGqlQk4PzkWmtuxYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=oWKlb4iqpsk/rzkP/d0ZBmUWabW6+n6Aopow3bwKm+6p4zxnBRw1/zYCeNfyGT2ihLF94TyoOrlHmOFaAPChycSITcM1ZyOMuaLAVyWUUGEUfm2wE/8e0OvmnEVIE3WiYnqt0Ati232Ak+5SBl9ZVwgFPQX69qP3s9/JA8AtAds= 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=X06cNDfC; 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="X06cNDfC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733398974; 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=Te8ZvVw+O5gq4halpcCzze57tU3DuBnleFTWqguRczw=; b=X06cNDfCoZZQtLrEwV8KnK6LlK6k6n0n4oB+MGAnOUIMhi7cP+y7SnBhC7S0ZQK/hI45lW j15eOWuJB+zMa0WA3J5sIkx4QmGmEZIG2h7WLsAqDNvmyemAy3k4HCCC7td+lHVheYnmgc yTRa1IUEcFuD9bSU67IIAD2eRXaB3DA= Received: from mx-prod-mc-01.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-427-2nmQ7ydEO_61CuwQZFidyQ-1; Thu, 05 Dec 2024 06:42:22 -0500 X-MC-Unique: 2nmQ7ydEO_61CuwQZFidyQ-1 X-Mimecast-MFC-AGG-ID: 2nmQ7ydEO_61CuwQZFidyQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 987F91955F43; Thu, 5 Dec 2024 11:42:21 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.67.24.108]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4607D1956094; Thu, 5 Dec 2024 11:42:17 +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 v2 1/3] dm array: fix releasing a faulty array block twice in dm_array_cursor_end Date: Thu, 5 Dec 2024 19:41:51 +0800 Message-ID: <20241205114153.1496986-2-mtsai@redhat.com> In-Reply-To: <20241205114153.1496986-1-mtsai@redhat.com> References: <20241205114153.1496986-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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: H3am9WRaS2APCSc0CKDjl41BRYhyDads6rYky7Ct31g_1733398941 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index 157c9bd2fed7..4866ff56125f 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -917,23 +917,27 @@ 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: + dm_btree_cursor_end(&c->cursor); + c->block = NULL; + c->ab = NULL; return r; } From patchwork Thu Dec 5 11:41:52 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: 13895086 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 16510207679 for ; Thu, 5 Dec 2024 11:42:35 +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=1733398957; cv=none; b=mhy7d1ZfayKvWgNgItDpXRnWPZfI2UcKRSha6/uN0yrNWBCrdO4SJR7liWor92CvZu+U8X48pYSrbHu9VgohhOoYokNMK+dYWqa0bmhBaEcsjGKqKzypBeTsW+88oYKufbWGiBPy40VBvl4/ax5bvMIpUYT0WxjjQ+uIKUtfWWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733398957; c=relaxed/simple; bh=9YQV1bQCQYzAGUdFZxokDRnSEPlTbnREMfLTjjseGRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=ndNIMjF2iA1d4ka6yGUtlSRUxFyI/ydj4S9CmcwUUdyqs5ffmFmyM0VXuDN+31h3O5cYGMfK83Vd9UBnsuOSpAxZv4GUWaembtRXWnJhqYYHrydz2Q9qve1pNABDQfhe9CeVzHmQbu2TAcGkry+Y53wccYl225vFsLCrqBdqBQY= 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=J9m6moOm; 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="J9m6moOm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733398955; 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=QNO9FLqIWDf0zA96q7mv5X6+N9pVBjpV9hgiijEuMr8=; b=J9m6moOmsp/F+pzpAqg+GQV4mnLK+PH0dSWgiP2R8D15qmfFAHk1rYnIsPLCFi3c/1r9J2 oY8TkcEEn57D2nM+fpJ/p7Hju8tvUY1aFvpwHLOpp6rW0N7rMaGODcEj+VuQHAcr0MjsoL l2G/FZprLrqqP+wmZDHi64n3ojUi8l8= 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-601-vYJ359NvMLyb_jSYUvDglQ-1; Thu, 05 Dec 2024 06:42:30 -0500 X-MC-Unique: vYJ359NvMLyb_jSYUvDglQ-1 X-Mimecast-MFC-AGG-ID: vYJ359NvMLyb_jSYUvDglQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 B658819560BC; Thu, 5 Dec 2024 11:42:29 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.67.24.108]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A7A51956094; Thu, 5 Dec 2024 11:42:25 +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 v2 2/3] dm array: fix unreleased btree blocks on closing a faulty array cursor Date: Thu, 5 Dec 2024 19:41:52 +0800 Message-ID: <20241205114153.1496986-3-mtsai@redhat.com> In-Reply-To: <20241205114153.1496986-1-mtsai@redhat.com> References: <20241205114153.1496986-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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: bhBqamwDh28x9HP93K_nGKEePfbtcL6uNPh2n_waPbM_1733398949 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") --- 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 4866ff56125f..0850dfdffc8c 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -960,10 +960,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 Thu Dec 5 11:41:53 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: 13895087 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 5627920A5EA for ; Thu, 5 Dec 2024 11:42:38 +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=1733398961; cv=none; b=YZ+kG63trix8rbqI+2T2Hp+lYFn+W/lqNyfXepMo8ydDUvnr8nrZWoXigloFnWaIUrjKSTjKqvQ0kS2HFkit19iGGUxuR3hD2JbVYUymmNPpNWcy3mre37sblDBBjpc1movA/Up9fn0TkPoLAWyOEVps+LkQXgvgcJhwGwlSZi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733398961; c=relaxed/simple; bh=9LiNEUJailRTjLW4xWLM7k3Bo6mjK6os2YrTdl+0uko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=bXTsU5WyLvK8odRw2LZIcXhaXmyYOTP2vi8V6qpeV84mJl2k3gcozaQ4KP32xl9DOGiB8c4HAfXVSuXJjWWMKWcfSW1Lz0Ao6h3LhRZu/OPThK5hqE+64dn0WjRkpwikAhEDkv+xiF/d4T5TUFeVJysm6R310vbUbKNfFkdkJhw= 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=f/TLCuQC; 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="f/TLCuQC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733398958; 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=vIF9v8823C2wO9MvpPOUNzig0GUr4X2yiLwC/zjIs10=; b=f/TLCuQCGYMrj4UbfY8kqXoaII7AyOeh/i6vJz7sUXTle7W4t2j3TjLbTyBkuPmIwhqUn9 aRiU7KvocZlewgoYTe2icmmedtbjr/xcnumYa+u1Omi2Ed7gAruhmv9veExzK5HIzB/TIn y7AmiYHsbE8Lmi6yWu9gxh2q7a+eN70= 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-625-b-Wx27dPMqmbRwMr8vX2CA-1; Thu, 05 Dec 2024 06:42:37 -0500 X-MC-Unique: b-Wx27dPMqmbRwMr8vX2CA-1 X-Mimecast-MFC-AGG-ID: b-Wx27dPMqmbRwMr8vX2CA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 499A6195609F; Thu, 5 Dec 2024 11:42:36 +0000 (UTC) Received: from thinkpad.redhat.com (unknown [10.67.24.108]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D1A4F1956094; Thu, 5 Dec 2024 11:42:32 +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 v2 3/3] dm array: fix cursor index when skipping across block boundaries Date: Thu, 5 Dec 2024 19:41:53 +0800 Message-ID: <20241205114153.1496986-4-mtsai@redhat.com> In-Reply-To: <20241205114153.1496986-1-mtsai@redhat.com> References: <20241205114153.1496986-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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Ii9xFr1UdOInK4w7_W1Zl5pxcYq-WP6VaLY_WMG3Kf8_1733398956 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") --- 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 0850dfdffc8c..8f8792e55806 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c @@ -1003,6 +1003,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);