linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@redhat.com>
To: LVM2 development <lvm-devel@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	markus.schade@gmail.com, ejt@redhat.com,
	linux-block@vger.kernel.org, dm-devel@redhat.com,
	joe.thornber@gmail.com
Subject: Re: [lvm-devel] [dm-devel] kernel BUG at drivers/md/persistent-data/dm-space-map-disk.c:178
Date: Tue, 7 Jan 2020 10:46:27 +0000	[thread overview]
Message-ID: <20200107104627.plviq37qhok2igt4@reti> (raw)
In-Reply-To: <20200107103546.asf4tmlfdmk6xsub@reti>

On Tue, Jan 07, 2020 at 10:35:46AM +0000, Joe Thornber wrote:
> On Sat, Dec 28, 2019 at 02:13:07AM +0000, Eric Wheeler wrote:
> > On Fri, 27 Dec 2019, Eric Wheeler wrote:
> 
> > > Just hit the bug again without mq-scsi (scsi_mod.use_blk_mq=n), all other 
> > > times MQ has been turned on. 
> > > 
> > > I'm trying the -ENOSPC hack which will flag the pool as being out of space 
> > > so I can recover more gracefully than a BUG_ON. Here's a first-draft 
> > > patch, maybe the spinlock will even prevent the issue.
> > > 
> > > Compile tested, I'll try on a real system tomorrow.
> > > 
> > > Comments welcome:
> 
> Both sm_ll_find_free_block() and sm_ll_inc() can trigger synchronous IO.  So you
> absolutely cannot use a spin lock.
> 
> dm_pool_alloc_data_block() holds a big rw semaphore which should prevent anything
> else trying to allocate at the same time.

I suspect the problem is to do with the way we search for the new block in the 
space map for the previous transaction (sm->old_ll), and then increment in the current
transaction (sm->ll).

We keep old_ll around so we can ensure we never (re) allocate a block that's used in
the previous transaction.  This gives us our crash resistance, since if anything goes
wrong we effectively rollback to the previous transaction.

What I think we should be doing is running find_free on the old_ll, then double checking
it's not actually used in the current transaction.  ATM we're relying on smd->begin being
set properly everywhere, and I suspect this isn't the case.  A quick look shows sm_disk_inc_block()
doesn't adjust it.  sm_disk_inc_block() can be called when breaking sharing of a neighbouring entry
in a leaf btree node ... and we know you use snapshots very heavily.

I'll get a patch to you later today.

- Joe


  reply	other threads:[~2020-01-07 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 18:40 kernel BUG at drivers/md/persistent-data/dm-space-map-disk.c:178 with scsi_mod.use_blk_mq=y Eric Wheeler
2019-09-25 20:01 ` Mike Snitzer
2019-09-25 20:33   ` Eric Wheeler
2019-09-26 18:27   ` Eric Wheeler
2019-09-27  8:32     ` Joe Thornber
2019-09-27 18:45       ` Eric Wheeler
2019-12-20 19:54 ` [dm-devel] " Eric Wheeler
2019-12-27  1:47   ` [dm-devel] kernel BUG at drivers/md/persistent-data/dm-space-map-disk.c:178 Eric Wheeler
2019-12-28  2:13     ` Eric Wheeler
2020-01-07 10:35       ` [lvm-devel] " Joe Thornber
2020-01-07 10:46         ` Joe Thornber [this message]
2020-01-07 12:28           ` [dm-devel] [lvm-devel] " Joe Thornber
2020-01-07 18:47             ` Eric Wheeler
2020-01-14 21:52             ` Eric Biggers
2020-01-15  1:22               ` Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200107104627.plviq37qhok2igt4@reti \
    --to=thornber@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=joe.thornber@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=lvm-devel@redhat.com \
    --cc=markus.schade@gmail.com \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).