All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: socketpair@gmail.com
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] ublk: publish a new device by its id only once it is set up
Date: Fri, 6 Nov 2026 08:48:52 -0600	[thread overview]
Message-ID: <au3o1OB1vxt1fJ-1@fedora-laptop> (raw)
In-Reply-To: <20261105-ublk-del-gendisk-hang-v1-1-913a91a4314d@gmail.com>

On Thu, Nov 05, 2026 at 12:25:05AM +0500, Mark Korenberg via B4 Relay wrote:
> From: Mark Korenberg <socketpair@gmail.com>
> 
> ADD_DEV stores the device in ublk_index_idr when it allocates the id,
> and control commands find it there as soon as ublk_add_chdev() has
> initialized its struct device, before the char device is added. If
> dev_set_name() or cdev_device_add() then fails, ublk_add_chdev() drops
> the initial reference to free the device. A DEL_DEV that found the
> device meanwhile waits for ublk_ctl_mutex, then calls ublk_remove():
> cdev_device_del() of a device that was never added, and a second put of
> the initial reference, which frees the device under the callers still
> holding references.
> 
> Reserve the id with a NULL entry, which idr_find() and the idr iterators
> skip, and store the device once ublk_add_chdev() succeeded.
> 
> Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
> Signed-off-by: Mark Korenberg <socketpair@gmail.com>

Reviewed-by: Ming Lei <tom.leiming@gmail.com>

Thanks,
Ming

  reply	other threads:[~2026-11-06 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 19:25 [PATCH 0/2] ublk: don't let one stuck device block control of all ublk devices Mark Korenberg
2026-11-04 19:25 ` Mark Korenberg via B4 Relay
2026-11-04 19:25 ` [PATCH 1/2] ublk: publish a new device by its id only once it is set up Mark Korenberg
2026-11-04 19:25   ` Mark Korenberg via B4 Relay
2026-11-06 14:48   ` Ming Lei [this message]
2026-11-04 19:25 ` [PATCH 2/2] ublk: don't take ublk_ctl_mutex in DEL_DEV Mark Korenberg
2026-11-04 19:25   ` Mark Korenberg via B4 Relay
2026-11-06 14:53   ` Ming Lei
2026-11-09 21:41 ` [PATCH 0/2] ublk: don't let one stuck device block control of all ublk devices 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=au3o1OB1vxt1fJ-1@fedora-laptop \
    --to=tom.leiming@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=socketpair@gmail.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 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.