All of lore.kernel.org
 help / color / mirror / Atom feed
* A bug in dm-persistent-data module which leads to dm-thin metadata corruption
@ 2014-03-07  4:00 Teng-Feng Yang
  2014-03-07 15:14 ` Joe Thornber
  0 siblings, 1 reply; 3+ messages in thread
From: Teng-Feng Yang @ 2014-03-07  4:00 UTC (permalink / raw)
  To: device-mapper development

Dear all,

I had experienced a dm-thin metadata corruption a couple of days ago,
and I found that someone had
reported the similar corruption to dm-devel recently.
http://www.redhat.com/archives/dm-devel/2014-February/msg00157.html

Since this issue will leads to unrecoverable metadata corruption and
could be reproduced every time,
we add some traces and hope to find out the root cause of this. After
dumping the trace, I think we
might find a bug in dm-persistent-data and I will try my best to
explain it clearly in below.

When decreasing the reference count of a metadata block with its
reference count equals 3,
we will call dm_btree_remove() to remove this enrty from the B+tree
which keeps the reference count info
in metadata device.

The B+tree will try to rebalance the entry of the child nodes in each
node it traversed, and
the rebalance process contains the following steps.

(1) Finding the corresponding children in current node (shadow_current(s))
(2) Shadow the children block (issue BOP_INC)
(3) redistribute keys among children, and free children if necessary
(issue BOP_DEC)

Since the update of a metadata block's reference count could be
recursive, we will stash these
reference count update operations in smm->uncommitted and then process
them in a FILO fashion.
The problem is that step(3) could free the children which is created
in step(2), so the BOP_DEC issued
in step(3) will be carried out  before the BOP_INC issued in step(2)
since these BOPs will be processed in
FILO fashion. Once the BOP_DEC from step(3) tries to decrease the
reference count of newly shadow block,
it will report failure for its reference equals 0 before decreasing.
It looks like we can solve this issue by processing
these BOPs in a FIFO fashion instead of FILO.

Any comment will be grateful.

Thanks.
Dennis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-07 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07  4:00 A bug in dm-persistent-data module which leads to dm-thin metadata corruption Teng-Feng Yang
2014-03-07 15:14 ` Joe Thornber
2014-03-07 16:20   ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.