Re: [PATCH v1 2/9] ext2: mark s_next_generation as guarded by s_next_gen_lock

From: Jan Kara

Date: Fri Jul 17 2026 - 10:13:07 EST


On Thu 16-07-26 22:03:02, Timothy Day wrote:
> On Sun, 12 Jul 2026 12:56:03 -0400, Timothy Day wrote:
> > diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> > index 3999f8f3b156e..8c7f3772917bb 100644
> > --- a/fs/ext2/super.c
> > +++ b/fs/ext2/super.c
> > @@ -1125,9 +1125,11 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
> > goto failed_mount2;
> > }
> > sbi->s_gdb_count = db_count;
> > - sbi->s_next_generation = get_random_u32();
> > spin_lock_init(&sbi->s_next_gen_lock);
>
> If I change this to guard(spinlock_init)(&sbi->s_next_gen_lock), I should
> be able to avoid the context_unsafe() line right after this. I'll fix
> that in the next revision. There may be some other places in the series
> where I can make the same fix.

Yeah, I guess that would be a tad bit better.

Honza

--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR