lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080428103719.GA16030@infradead.org>
Date:	Mon, 28 Apr 2008 06:37:19 -0400
From:	Christoph Hellwig <hch@...radead.org>
To:	Takashi Sato <t-sato@...jp.nec.com>
Cc:	"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
	"xfs@....sgi.com" <xfs@....sgi.com>,
	"dm-devel@...hat.com" <dm-devel@...hat.com>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 1/3] Implement generic freeze feature

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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ