linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Angel Shtilianov <kernel@kyup.com>, linux-btrfs@vger.kernel.org
Subject: Re: Btrfs umount hang
Date: Mon, 7 Aug 2017 14:10:41 -0400	[thread overview]
Message-ID: <1d36851e-6a1c-1c32-ee00-96f43ead55d2@suse.com> (raw)
In-Reply-To: <c9fbfedd-1a3b-b6f4-8773-1a7e5f79f18a@suse.com>


[-- Attachment #1.1: Type: text/plain, Size: 2688 bytes --]

On 8/7/17 1:19 PM, Jeff Mahoney wrote:
> On 8/7/17 10:12 AM, Angel Shtilianov wrote:
>> Hi there,
>> I'm investigating sporadic hanging during btrfs umount. The FS is
>> contained in a loop mounted file.
>> I have no reproduction scenario and the issue may happen once a day or
>> once a month. It is rare, but frustrating.
>> I have a crashdump (the server has been manually crashed and collected
>> a crashdump), so I could take look through the data structures.
>> What happens is that umount is getting in D state and a the kernel
>> complains about hung tasks. We are using kernel 4.4.y The actual back
>> trace is from 4.4.70, but this happens with all the 4.4 kernels I've
>> used (4.4.30 through 4.4.70).
>> Tasks like:
>> INFO: task kworker/u32:9:27574 blocked for more than 120 seconds.
>> INFO: task kworker/u32:12:27575 blocked for more than 120 seconds.
>> INFO: task btrfs-transacti:31625 blocked for more than 120 seconds.
>> are getting blocked waiting for btrfs_tree_read_lock, which is owned
>> by task umount:31696 (which is also blocked for more than 120 seconds)
>> regarding the lock debug.
>>
>> umount is hung in "cache_block_group", see the '>' mark:
>>        while (cache->cached == BTRFS_CACHE_FAST) {
>>                 struct btrfs_caching_control *ctl;
>>
>>                 ctl = cache->caching_ctl;
>>                 atomic_inc(&ctl->count);
>>                 prepare_to_wait(&ctl->wait, &wait, TASK_UNINTERRUPTIBLE);
>>                 spin_unlock(&cache->lock);
>>
>>>                schedule();
>>
>>                 finish_wait(&ctl->wait, &wait);
>>                 put_caching_control(ctl);
>>                 spin_lock(&cache->lock);
>>         }
>>
>> The complete backtraces could be found in the attached log.
>>
>> Do you have any ideas ?
> 
> Hi Angel -
> 
> In your log, it says lockdep is disabled.  What tripped it earlier?
> Lockdep really should be catching locking deadlocks in situations like
> this, if that's really the underlying cause.

Actually, I'm not sure if lockdep would catch this one.  Here's my
hypothesis:

kworker/u32:9 is waiting on a read lock while reading the free space
cache, which means it owns the cache->cached value and will issue the
wakeup when it completes.

umount is waiting on for the wakeup from kworker/u32:9 but is holding
some tree locks in write mode.

If kworker/u32:9 is waiting on the locks that umount holds, we have a
deadlock.

Can you dump the extent buffer that kworker/u32:9 is waiting on?  Part
of that will contain the PID of the holder, and if matches umount, we
found the cause.

-Jeff

-- 
Jeff Mahoney
SUSE Labs


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-08-07 18:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 14:12 Btrfs umount hang Angel Shtilianov
2017-08-07 15:30 ` Nikolay Borisov
2017-08-07 17:19 ` Jeff Mahoney
2017-08-07 18:10   ` Jeff Mahoney [this message]
2017-08-08 11:30     ` Angel Shtilianov
2017-08-09 15:42       ` Jeff Mahoney
2017-08-09 22:30         ` Angel Shtilianov
2017-08-10 14:49           ` Angel Shtilianov

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=1d36851e-6a1c-1c32-ee00-96f43ead55d2@suse.com \
    --to=jeffm@suse.com \
    --cc=kernel@kyup.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).