From: Christoph Hellwig <hch@infradead.org>
To: Takashi Sato <t-sato@yk.jp.nec.com>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
"xfs@oss.sgi.com" <xfs@oss.sgi.com>,
"dm-devel@redhat.com" <dm-devel@redhat.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 1/3] Implement generic freeze feature
Date: Mon, 28 Apr 2008 06:37:19 -0400 [thread overview]
Message-ID: <20080428103719.GA16030@infradead.org> (raw)
In-Reply-To: <20080428193123t-sato@mail.jp.nec.com>
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.
next prev parent reply other threads:[~2008-04-28 10:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 10:31 [RFC PATCH 1/3] Implement generic freeze feature Takashi Sato
2008-04-28 10:37 ` Christoph Hellwig [this message]
2008-04-28 12:59 ` Takashi Sato
2008-04-28 13:03 ` Christoph Hellwig
2008-04-30 1:10 ` Takashi Sato
-- strict thread matches above, loose matches on Subject: below --
2008-05-22 8:50 Takashi Sato
2008-05-25 19:32 ` Christoph Hellwig
2008-05-27 10:20 ` Takashi Sato
2008-05-14 8:06 Takashi Sato
2008-05-20 3:57 ` Andreas Dilger
2008-05-21 1:23 ` Takashi Sato
2008-04-01 12:17 Takashi Sato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080428103719.GA16030@infradead.org \
--to=hch@infradead.org \
--cc=dm-devel@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=t-sato@yk.jp.nec.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox