Re: [PATCH 5/6] super: use common iterator (Part 2)

From: James Bottomley
Date: Fri Mar 28 2025 - 14:58:43 EST


On Fri, 2025-03-28 at 17:15 +0100, Christian Brauner wrote:
[...]
> +static inline void super_cb_grabbed(struct super_block *sb,
> +     void (*f)(struct super_block *,
> void *),
> +     void *arg)
> +{
> + if (super_lock_excl(sb)) {
> + bool active = atomic_inc_not_zero(&sb->s_active);
> + super_unlock_excl(sb);
> + if (active)
> + f(sb, arg);
> + deactivate_super(sb);

I don't think this can be right: if we fail to increment s_active
because it's zero, we shouldn't call deactivate_super(), should we?

Regards,

James