All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH v11 08/13] zloop: add storage element emulation
Date: Fri, 20 Nov 2026 09:51:41 -0800	[thread overview]
Message-ID: <82e0ce43-73cb-4374-8761-22c178a29f05@kernel.org> (raw)
In-Reply-To: <20261120173609.GA1206@lst.de>

On 11/20/26 09:36, Christoph Hellwig wrote:
> On Fri, Nov 20, 2026 at 09:27:15AM -0800, Damien Le Moal wrote:
>> On 11/20/26 07:20, Christoph Hellwig wrote:
>>> I think the Sashiko comment here needs adressing - nothing in the remove
>>> path synchronizes against the raw underlying device access.  Lifting the
>>> stor_elements_lock critical section from zloop_forget_cache to the
>>> caller and making it unconditional should fix that.
>>
>> I do not think that is enough because remove and restore drop the stor lock for
>> the msleep. So this would still be very racy. But adding a disk ref get/put
>> around remove/restore code should solve all issues cleanly as that will prevent
>> the drive being removed while these operations are on-going.
> 
> The disk is already opened and references, that is not the problem.
> The problem is that after del_gendisk, another disk with the same name
> could show up and use the same files.  So we do not some kind of
> synchornization to ensure that del_gendisk doesn't happen while a depop
> is in progress.

Hmmm... That can actually happen regardless of storage elements operations
because we do idr_remove() with zloop_ctl_mutex() being held, but before calling
del_gendisk() without the zloop_ctl_mutex being held. So we do have a race for
the device ID being reused, no?

And taking the storage element mutex will *not* achieve serialization of the
remove & storage element operation because the mutex is released and re-taken by
the remove & restore operations. However, we can simply wait for these
operations by looking at the remove_id and restore_in_progress fields.


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-11-20 17:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 21:36 [PATCH v11 00/13] Add support for storage element depopulation Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 01/13] block: introduce disk_zone_is_offline() Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 02/13] block: refactor blk_revalidate_disk_zones() Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 03/13] block: allow dropping all zone write plugs on revalidation Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 04/13] block: introduce storage element management Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 05/13] block: add storage element management ioctls Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 06/13] zloop: fix ordered zone append handling Damien Le Moal
2026-11-19  7:19   ` Hannes Reinecke
2026-11-20 15:20   ` Christoph Hellwig
2026-11-16 21:36 ` [PATCH v11 07/13] zloop: fix zone reporting consistency Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 08/13] zloop: add storage element emulation Damien Le Moal
2026-11-16 21:59   ` sashiko-bot
2026-11-19  7:24   ` Hannes Reinecke
2026-11-19 12:57     ` Damien Le Moal
2026-11-20 15:20   ` Christoph Hellwig
2026-11-20 17:27     ` Damien Le Moal
2026-11-20 17:36       ` Christoph Hellwig
2026-11-20 17:51         ` Damien Le Moal [this message]
2026-11-20 18:05           ` Christoph Hellwig
2026-11-16 21:36 ` [PATCH v11 09/13] zloop: add degrade_element control command Damien Le Moal
2026-11-16 21:44   ` sashiko-bot
2026-11-16 21:36 ` [PATCH v11 10/13] scsi: scsi_proto: refine the definition of storage element health Damien Le Moal
2026-11-16 21:37 ` [PATCH v11 11/13] scsi: sd_zbc: always revalidate zones for disks supporting head depopulation Damien Le Moal
2026-11-16 21:37 ` [PATCH v11 12/13] scsi: sd_zbc: define storage element management operations Damien Le Moal
2026-11-16 21:52   ` sashiko-bot
2026-11-19  7:24   ` Hannes Reinecke
2026-11-20 15:21   ` Christoph Hellwig
2026-11-16 21:37 ` [PATCH v11 13/13] scsi: sd: fail read commands to offline zones early Damien Le Moal

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=82e0ce43-73cb-4374-8761-22c178a29f05@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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.