linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zqiang <qiang.zhang1211@gmail.com>
To: Matthew Wilcox <willy@infradead.org>, Jens Axboe <axboe@kernel.dk>
Cc: axboe@kernel.dk, hch@lst.de, sunhao.th@gmail.com,
	hch@infradead.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] block: fix incorrect references to disk objects
Date: Mon, 25 Oct 2021 16:27:58 +0800	[thread overview]
Message-ID: <9d2f7753-d7a7-f91e-077b-40b274199185@gmail.com> (raw)
In-Reply-To: <YW1n91DAaVyuISVV@casper.infradead.org>


On 2021/10/18 下午8:26, Matthew Wilcox wrote:
> On Mon, Oct 18, 2021 at 07:58:07PM +0800, Zqiang wrote:
>> When adding partitions to the disk, the reference count of the disk
>> object is increased. then alloc partition device and called
>> device_add(), if the device_add() return error, the reference
>> count of the disk object will be reduced twice, at put_device(pdev)
>> and put_disk(disk). this leads to the end of the object's life cycle
>> prematurely, and trigger following calltrace.
>>
>>    __init_work+0x2d/0x50 kernel/workqueue.c:519
>>    synchronize_rcu_expedited+0x3af/0x650 kernel/rcu/tree_exp.h:847
>>    bdi_remove_from_list mm/backing-dev.c:938 [inline]
>>    bdi_unregister+0x17f/0x5c0 mm/backing-dev.c:946
>>    release_bdi+0xa1/0xc0 mm/backing-dev.c:968
>>    kref_put include/linux/kref.h:65 [inline]
>>    bdi_put+0x72/0xa0 mm/backing-dev.c:976
>>    bdev_free_inode+0x11e/0x220 block/bdev.c:408
>>    i_callback+0x3f/0x70 fs/inode.c:226
>>    rcu_do_batch kernel/rcu/tree.c:2508 [inline]
>>    rcu_core+0x76d/0x16c0 kernel/rcu/tree.c:2743
>>    __do_softirq+0x1d7/0x93b kernel/softirq.c:558
>>    invoke_softirq kernel/softirq.c:432 [inline]
>>    __irq_exit_rcu kernel/softirq.c:636 [inline]
>>    irq_exit_rcu+0xf2/0x130 kernel/softirq.c:648
>>    sysvec_apic_timer_interrupt+0x93/0xc0
>>
>> Return directly after calling the put_device().
>>
>> Reported-by: Hao Sun <sunhao.th@gmail.com>
>> Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
> Fixes: 9d3b8813895d ("block: change the refcounting for partitions")
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Hello Jens Axboe

The patch description information of the previous v2 version is 
incorrect, v3 modified the description information, please applied the 
v3 version.

Thanks

Zqiang




  reply	other threads:[~2021-10-25  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 11:58 [PATCH v3] block: fix incorrect references to disk objects Zqiang
2021-10-18 12:26 ` Matthew Wilcox
2021-10-25  8:27   ` Zqiang [this message]
2021-10-25 13:44     ` Jens Axboe

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=9d2f7753-d7a7-f91e-077b-40b274199185@gmail.com \
    --to=qiang.zhang1211@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sunhao.th@gmail.com \
    --cc=willy@infradead.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).