Thread (37 messages) 37 messages, 4 authors, 2022-07-19

Re: [PATCH 09/10] md: only delete entries from all_mddevs when the disk is freed

From: Song Liu <song@kernel.org>
Date: 2022-07-19 06:28:25
Also in: linux-block

On Mon, Jul 18, 2022 at 10:07 PM Christoph Hellwig [off-list ref] wrote:
On Mon, Jul 18, 2022 at 11:20:39AM -0700, Song Liu wrote:
quoted
quoted
quoted
  static inline struct mddev *mddev_get(struct mddev *mddev)
  {
+     lockdep_assert_held(&all_mddevs_lock);
+
+     if (mddev->deleted)
+             return NULL;
      atomic_inc(&mddev->active);
      return mddev;
  }
Why can't we use 'atomic_inc_unless_zero' here and do away with the
additional 'deleted' flag?
quoted
I think atomic_inc_unless_zero() should work here. Alternatively, we can
also grab a big from mddev->flags as MD_DELETED.
s/big/bit/ ?
yeah, bit...
Yes, this could use mddev->flags.  I don't think atomic_inc_unless_zero
would work, as an array can have a refcount of 0 but we still allow
to take new references to it, the deletion only happens if the other
conditions in mddev_put are met.

Do you want me to repin the series using a flag?
Respin the series sounds good. Please also address Hannes' feedback
on 8/10.

Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help