Re: [PATCH 4/4] udf: Replace bkl with a mutex for protectudf_sb_info struct

From: Christoph Hellwig
Date: Sat Nov 06 2010 - 14:16:25 EST


> + mutex_lock(&sbi->lock);
> result = udf_relocate_blocks(inode->i_sb,
> old_block, &new_block);
> + mutex_unlock(&sbi->lock);

Moving the locking inside udf_relocate_blocks would be cleaner.

> @@ -570,7 +569,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
> if (!udf_parse_options(options, &uopt, true))
> return -EINVAL;
>
> - lock_kernel();
> + mutex_lock(&sbi->lock);

What are you protecting against here? Concurrent remount calls are
protects against by the VFS. Is there any reader that takes sbi->lock
to get a consistent view of the various options? It doesn't seem you
introduce one in this series, so it seems we could do fine without any
locking.

> - unlock_kernel();
> return -ENOMEM;
> }
>
> + mutex_init(&sbi->lock);
> + mutex_lock(&sbi->lock);

What are you locking against here? I can't fine anything that puts the
superblock on a global list in fill_super, and I can't find any code
that would look a superblock up that's not fully set up. I don't think
synchronization here in fill_super is needed at all.

> + /* Serialize writer access, replace the old bkl */
> + struct mutex lock;

Same comment as for the per-inode mutex applies here, too.

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