Re: [RFC] how to fix is_local_disk()?

Andrew Morton (akpm@digeo.com)
Sun, 4 May 2003 14:05:37 -0700


Christoph Hellwig <hch@lst.de> wrote:
>
> ...
> +static void do_emergency_remount(unsigned long foo)
> +{
> + struct super_block *sb;
> +
> + spin_lock(&sb_lock);
> + list_for_each_entry(sb, &super_blocks, s_list) {
> + sb->s_count++;
> + spin_unlock(&sb_lock);
> + down_read(&sb->s_umount);
> + if (sb->s_bdev && !(sb->s_flags & MS_RDONLY))
> + do_remount_sb(sb, MS_RDONLY, NULL, 1);
> + drop_super(sb);

You might need to check sb->s_root in here after acquiring sb->s_umount.
Otherwise the fs may have been unmounted while the semaphore was being waited
upon.

About half of the s_umount grabbers perform that check. The others might be
buggy. I'm not sure - it's all rather gunky in there and hard to tell what
the rules are.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/