Re: [RFC PATCH 1/1] fs/namespace.c: use spinlock instead of busy loop

From: Peter Zijlstra
Date: Wed Jun 17 2020 - 07:26:05 EST


On Wed, Jun 17, 2020 at 12:46:58PM +0206, John Ogness wrote:
> @@ -459,17 +469,39 @@ void mnt_drop_write_file(struct file *file)
> }
> EXPORT_SYMBOL(mnt_drop_write_file);
>
> +static void mnt_lock_writers(struct mount *mnt)
> +{
> +#ifdef CONFIG_SMP
> + int cpu;
> +
> + for_each_possible_cpu(cpu) {
> + spin_lock(&per_cpu_ptr(mnt->mnt_pcp,
> + cpu)->mnt_writers_lock);
> + }
> +#else
> + spin_lock(&mnt->mnt_writers_lock);
> +#endif
> +}
> +
> +static void mnt_unlock_writers(struct mount *mnt)
> +{
> +#ifdef CONFIG_SMP
> + int cpu;
> +
> + for_each_possible_cpu(cpu) {
> + spin_unlock(&per_cpu_ptr(mnt->mnt_pcp,
> + cpu)->mnt_writers_lock);
> + }
> +#else
> + spin_unlock(&mnt->mnt_writers_lock);
> +#endif
> +}

*groan*.. this is brlock reincarnate :-/ Also broken.