Re: [RFC PATCH 1/3] Implement generic freeze feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 28, 2008 at 07:31:23PM +0900, Takashi Sato wrote:
> +	/* Initialize semaphore for freeze. */
> +	sema_init(&bdev->bd_freeze_sem, 1);

The freezing process is already protected by bd_mount_sem, so I don't
think there's need for another one.

> --- linux-2.6.25.org/fs/buffer.c	2008-04-17 11:49:44.000000000 +0900
> +++ linux-2.6.25-freeze/fs/buffer.c	2008-04-24 20:43:28.000000000 +0900
> @@ -201,6 +201,19 @@ struct super_block *freeze_bdev(struct b
>  {
>  	struct super_block *sb;
>  
> +	down(&bdev->bd_freeze_sem);
> +	sb = get_super_without_lock(bdev);
> +
> +	/* If super_block has been already frozen, return. */
> +	if (sb && sb->s_frozen != SB_UNFROZEN) {
> +		put_super(sb);
> +		up(&bdev->bd_freeze_sem);
> +		return sb;
> +	}
> +
> +	if (sb)
> +		put_super(sb);
> +
>  	down(&bdev->bd_mount_sem);
>  	sb = get_super(bdev);

I think the protection against double freezes would be better done by
using a trylock on bd_mount_sem.  In fact after that it could be changed
from a semaphore to a simple test_and_set_bit.
>  			error = -ENOTTY;
>  		break;
> +
> +	case FIFREEZE: {

This would be better to split intot a small helper ala ioctl_fibmap()

> +	case FITHAW: {

Same here.

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

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux