linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Takashi Sato" <t-sato@yk.jp.nec.com>
To: "Christoph Hellwig" <hch@infradead.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	<linux-fsdevel@vger.kernel.org>, <dm-devel@redhat.com>,
	<viro@ZenIV.linux.org.uk>, <linux-ext4@vger.kernel.org>,
	<xfs@oss.sgi.com>, "Christoph Hellwig" <hch@infradead.org>,
	<axboe@kernel.dk>, <mtk.manpages@googlemail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] Implement generic freeze feature
Date: Fri, 29 Aug 2008 18:37:28 +0900	[thread overview]
Message-ID: <328724AE665B49F8A8B60D92187C4BBF@nsl.ad.nec.co.jp> (raw)
In-Reply-To: <20080822181458.GA15469@infradead.org>

Hi,

Christoph Hellwig wrote:
>On Mon, Aug 18, 2008 at 09:28:19PM +0900, Takashi Sato wrote:
>> +    down(&bdev->bd_freeze_sem);
>> +    bdev->bd_freeze_count++;
>> +    if (bdev->bd_freeze_count > 1) {
>> +            sb = get_super(bdev);
>> +            drop_super(sb);
>> +            up(&bdev->bd_freeze_sem);
>> +            return sb;
>> +    }
>> +
>>      down(&bdev->bd_mount_sem);
>
>Now you have a reference counter of freezes which actually is pretty
>sensible, but also needs some documentation.  What I don't understand
>here at all is why you do the get_super/drop_super in the already frozen
>case.

Even if the filesystem has already been frozen, the superblock
should be returned. Because a caller should recognize the success of
freeze_bdev() and call thaw_bdev() to decrease the reference count. 
But I will remove drop_super() as it should be called in thaw_bdev().

>
>Now that the freeze_count has replaced one of the uses of bd_mount_sem
>you should also replace the other use in the unmount path by simply
>checking for the freez_count and abort if it's set.  To do so you'll
>need to hold the bd_mount_sem over the whole unmount operation to
>prevent new frezes from coming in.

In the original implementation,
unmount is protected by s_umount(semaphore),
not bd_mount_sem.  So, unmount task waits for unfreeze.
I think this original behavior shouldn't be changed, 
so the existing s_umount lock is better.

>
>As others noted it should be a mutex and not a semaphore.

As you said, we should use the mutex.
I will replace it.

>
>>  /*
>> + * ioctl_freeze - Freeze the filesystem.
>> + *
>> + * @filp:   target file
>> + *
>> + * Call freeze_bdev() to freeze the filesystem.
>> + */
>> +static int ioctl_freeze(struct file *filp)
>
>This is not quite kerneldcoc format, which would ne a /** as commnt
>start.  But I don't think the comment is actually needed, it's a pretty
>obvious file scope function. (Same commnt also applies to ioctl_thaw)

I will remove these comments.

>
>> +    struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
>> +
>> +    if (!capable(CAP_SYS_ADMIN))
>> +            return -EPERM;
>> +
>> +    /* If filesystem doesn't support freeze feature, return. */
>> +    if (sb->s_op->write_super_lockfs == NULL)
>> +            return -EOPNOTSUPP;
>> +
>> +    /* If a regular file or a directory isn't specified, return. */
>> +    if (sb->s_bdev == NULL)
>> +            return -EINVAL;
>
>I don't understand this commnt.  What you are checking is that the
>filesystem has a non-NULL s_bdev, which implies a not blockdevice-backed
>filesystem.

I will fix the comment as :
" If a blockdevice-backed filesystem isn't specified, return."

Cheers, Takashi

  reply	other threads:[~2008-08-29  9:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-18 12:28 [PATCH 1/3] Implement generic freeze feature Takashi Sato
2008-08-21 19:58 ` Andrew Morton
2008-08-22  7:09   ` Andreas Dilger
2008-08-29  9:36   ` Takashi Sato
2008-08-22 18:14 ` Christoph Hellwig
2008-08-29  9:37   ` Takashi Sato [this message]
2008-09-04 16:55 ` Eric Sandeen
2008-09-11 10:58   ` Takashi Sato
  -- strict thread matches above, loose matches on Subject: below --
2008-09-08 11:52 Takashi Sato
2008-09-08 17:10 ` Christoph Hellwig
2008-09-11 11:11   ` Takashi Sato
2008-07-22  9:37 Takashi Sato
2008-06-30 12:23 Takashi Sato
2008-07-01  8:08 ` Christoph Hellwig
2008-06-24  6:59 Takashi Sato
2008-06-24 21:48 ` Andrew Morton
2008-06-27 11:33   ` 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=328724AE665B49F8A8B60D92187C4BBF@nsl.ad.nec.co.jp \
    --to=t-sato@yk.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=viro@ZenIV.linux.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).