[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180422012259.v2s6z2p7q53k5xyp@garbanzo.do-not-panic.com>
Date: Sat, 21 Apr 2018 18:22:59 -0700
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: Jan Kara <jack@...e.cz>
Cc: "Luis R. Rodriguez" <mcgrof@...nel.org>, viro@...iv.linux.org.uk,
bart.vanassche@....com, ming.lei@...hat.com, tytso@....edu,
darrick.wong@...cle.com, jikos@...nel.org, rjw@...ysocki.net,
pavel@....cz, len.brown@...el.com, linux-fsdevel@...r.kernel.org,
boris.ostrovsky@...cle.com, jgross@...e.com,
todd.e.brandt@...ux.intel.com, nborisov@...e.com,
martin.petersen@...cle.com, ONeukum@...e.com,
oleksandr@...alenko.name, oleg.b.antonyan@...il.com,
yu.chen.surf@...il.com, dan.j.williams@...el.com,
linux-pm@...r.kernel.org, linux-block@...r.kernel.org,
linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
jlayton@...hat.com
Subject: Re: [PATCH 03/11] fs: add frozen sb state helpers
On Sun, Apr 22, 2018 at 01:53:23AM +0200, Jan Kara wrote:
> On Fri 20-04-18 11:49:32, Luis R. Rodriguez wrote:
> > On Tue, Apr 17, 2018 at 05:59:36PM -0700, Luis R. Rodriguez wrote:
> > > On Thu, Dec 21, 2017 at 12:03:29PM +0100, Jan Kara wrote:
> > > > Hello,
> > > >
> > > > I think I owe you a reply here... Sorry that it took so long.
> > >
> > > Took me just as long :)
> > >
> > > > On Fri 01-12-17 22:13:27, Luis R. Rodriguez wrote:
> > > > >
> > > > > I'll note that its still not perfectly clear if really the semantics behind
> > > > > freeze_bdev() match what I described above fully. That still needs to be
> > > > > vetted for. For instance, does thaw_bdev() keep a superblock frozen if we
> > > > > an ioctl initiated freeze had occurred before? If so then great. Otherwise
> > > > > I think we'll need to distinguish the ioctl interface. Worst possible case
> > > > > is that bdev semantics and in-kernel semantics differ somehow, then that
> > > > > will really create a holy fucking mess.
> > > >
> > > > I believe nobody really thought about mixing those two interfaces to fs
> > > > freezing and so the behavior is basically defined by the implementation.
> > > > That is:
> > > >
> > > > freeze_bdev() on sb frozen by ioctl_fsfreeze() -> EBUSY
> > > > freeze_bdev() on sb frozen by freeze_bdev() -> success
> > > > ioctl_fsfreeze() on sb frozen by freeze_bdev() -> EBUSY
> > > > ioctl_fsfreeze() on sb frozen by ioctl_fsfreeze() -> EBUSY
> > > >
> > > > thaw_bdev() on sb frozen by ioctl_fsfreeze() -> EINVAL
> > >
> > > Phew, so this is what we want for the in-kernel freezing so we're good
> > > and *can* combine these then.
> >
> > I double checked, and I don't see where you get EINVAL for this case.
> > We *do* keep the sb frozen though, which is good, and the worst fear
> > I had was that we did not. However we return 0 if there was already
> > a prior freeze_bdev() or ioctl_fsfreeze() other than the context that
> > started the prior freeze (--bdev->bd_fsfreeze_count > 0).
> >
> > The -EINVAL is only returned currently if there were no freezers.
> >
> > int thaw_bdev(struct block_device *bdev, struct super_block *sb)
> > {
> > int error = -EINVAL;
> >
> > mutex_lock(&bdev->bd_fsfreeze_mutex);
> > if (!bdev->bd_fsfreeze_count)
> > goto out;
>
> But this is precisely where we'd bail if we freeze sb by ioctl_fsfreeze()
> but try to thaw by thaw_bdev(). ioctl_fsfreeze() does not touch
> bd_fsfreeze_count...
Ah, yes, I see that now, thanks!
Luis
Powered by blists - more mailing lists