From: Josef Bacik <josef@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Josef Bacik <josef@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
chris.mason@oracle.com, hch@lst.de
Subject: Re: [PATCH] Introduce freeze_super and thaw_super for the fsfreeze ioctl
Date: Tue, 23 Mar 2010 11:03:01 -0400 [thread overview]
Message-ID: <20100323150301.GD2381@localhost.localdomain> (raw)
In-Reply-To: <20100323144828.GH30031@ZenIV.linux.org.uk>
On Tue, Mar 23, 2010 at 02:48:28PM +0000, Al Viro wrote:
> On Tue, Mar 23, 2010 at 10:34:56AM -0400, Josef Bacik wrote:
> > +++ b/fs/block_dev.c
> > @@ -245,35 +245,13 @@ struct super_block *freeze_bdev(struct block_device *bdev)
> > sb = get_active_super(bdev);
>
> sb is an active locked reference
>
> > + error = freeze_super(sb, 1);
> > + if (error) {
> > + bdev->bd_fsfreeze_count--;
> > + mutex_unlock(&bdev->bd_fsfreeze_mutex);
> > + return ERR_PTR(error);
> > }
> > - up_write(&sb->s_umount);
> >
> > out:
> > sync_blockdev(bdev);
>
> > static int ioctl_fsfreeze(struct file *filp)
> > {
> > struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
>
> sb is an active reference
>
I don't understand how this is an active reference? We are talking about
s_active right?
> > + ret = freeze_super(sb, 0);
> > +
> > + return ret;
> > }
>
> > +int freeze_super(struct super_block *sb, int locked)
> > +{
> > + int ret;
> > +
> > + if (!locked) {
> > + spin_lock(&sb_lock);
> > + ret = grab_super(sb);
>
> What in hell for? We already hold an active reference here. That's leaving
> aside the obvious comments about argument-dependent locking state...
We need to have an active (s_active++) reference to the super throughout the
freeze to make sure somebody doesn't come along and umount the fs until after we
do the thaw. Now, most of this code is copy and pasted, so I don't claim to
understand why it was done this way to begin with, I was just trying to not
change as much as possible. But from what I can tell, we _need_ to have the
active reference on the sb until we thaw. Freeze_bdev already gets this active
reference via get_active_super(), but from what I can tell the ioctl_fsfreeze
doesn't have an active reference, hence the locked argument, so we can do a
grab_super and get the active reference. Would you prefer that I have a
__freeze_super that expects the sb to already have an active reference, and then
make freeze_super do the grab_super instead? Thanks,
Josef
next prev parent reply other threads:[~2010-03-23 15:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 14:22 [PATCH] Introduce freeze_super and thaw_super for the fsfreeze ioctl Josef Bacik
2010-03-23 14:28 ` Al Viro
2010-03-23 14:34 ` Josef Bacik
2010-03-23 14:48 ` Al Viro
2010-03-23 15:03 ` Josef Bacik [this message]
2010-03-23 15:09 ` Al Viro
2010-03-23 15:12 ` Al Viro
2010-03-23 15:15 ` Al Viro
2010-03-23 22:31 ` Nigel Cunningham
2010-03-23 23:18 ` Al Viro
2010-03-23 23:47 ` Al Viro
2010-03-23 23:52 ` Nigel Cunningham
2010-03-23 23:55 ` Nigel Cunningham
2010-03-24 0:21 ` Al Viro
2010-03-24 0:25 ` Nigel Cunningham
2010-03-24 0:03 ` Nigel Cunningham
2010-03-23 18:19 ` Sunil Mushran
2010-03-23 22:25 ` Nigel Cunningham
2010-03-24 1:17 ` Josef Bacik
2010-03-24 5:16 ` Nigel Cunningham
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=20100323150301.GD2381@localhost.localdomain \
--to=josef@redhat.com \
--cc=chris.mason@oracle.com \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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).