From: Jeff Layton <jlayton@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>, Amir Goldstein <amir73il@gmail.com>
Cc: yangerkun <yangerkun@huawei.com>,
"zhangyi (F)" <yi.zhang@huawei.com>,
overlayfs <linux-unionfs@vger.kernel.org>,
Miao Xie <miaoxie@huawei.com>
Subject: Re: [fsck.overlay RFC PATCH] overlay: add fsck utility
Date: Tue, 20 Mar 2018 12:55:29 -0400 [thread overview]
Message-ID: <1521564929.4686.21.camel@kernel.org> (raw)
In-Reply-To: <CAJfpegtGWK=xY0VgAAaSi2PHnTQ-buyoMG5TbezeAQ64c8OR+g@mail.gmail.com>
On Tue, 2018-03-20 at 17:44 +0100, Miklos Szeredi wrote:
> On Thu, Mar 8, 2018 at 8:51 AM, Amir Goldstein <amir73il@gmail.com> wrote:
> > On Thu, Mar 8, 2018 at 4:38 AM, yangerkun <yangerkun@huawei.com> wrote:
> > >
> >
> > [...]
> > > > > >
> > > > > > In fsck.overlay, lower layer file/dir may be modified with there is not
> > > > > > I_OVL_INUSE in lower layer, but we cannot check does lower layer mounted
> > > > > > with I_OVL_INUSE.
> > > > > >
> >
> > [...]
> > > > Also, if we follow my suggestion above for upperdir/workdir
> > > > fsck.overlay may still
> > > > try to aquire I_OVL_INUSE on lowerdir with O_EXCL|O_DIRECTORY and kernel
> > > > can test I_OVL_INUSE flag on lowerdir without trying to set it on mount.
> > >
> > >
> > > It's good when we want to mount overlayfs with fsck.overlay is running; But
> > > when there is a mounted overlayfs before fsck.overlay, we cannot use this
> > > way to check if the lower layer has already been used.
> >
> > Perhaps we should acquire a shared POSIX lock from kernel on lower/upper/work
> > dirs and fsck.overlay should acquire an exclusive POSIX lock.
> >
> > I'm not sure how acquiring a POSIX lock from kernel should work and which
> > task should be the owner of the lock, but generally overlayfs could either have
> > a single owner task in the kernel for all super blocks or one owner
> > per sb, in which
> > case, we could acquire an exclusive lock on work/upper dirs instead of using
> > the custom I_OVL_INUSE lock.
> >
> > Just a thought - not sure if this makes sense. CC'ing Jeff for reality check.
>
> Much better to use flock(2) locks which, unlike POSIX locks, have sane
> semantics. The owner is not a task but a file, so just need to keep
> an file open referring to each layer's root in overlayfs.
>
Oops, missed this thread before.
Yes, a flock lock should be fine as long as you're locking the whole
file (and I assume you would be here). If you need byte ranges, consider
OFD locks.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2018-03-20 16:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 5:49 [fsck.overlay RFC PATCH] overlay: add fsck utility zhangyi (F)
2017-11-17 17:13 ` Amir Goldstein
2017-11-17 18:39 ` Darrick J. Wong
2017-11-20 7:12 ` zhangyi (F)
2017-11-20 6:56 ` zhangyi (F)
2017-11-20 7:29 ` Amir Goldstein
2017-11-20 9:00 ` zhangyi (F)
2017-11-20 7:42 ` Eryu Guan
2017-11-21 2:30 ` Theodore Ts'o
2017-11-21 6:06 ` zhangyi (F)
2018-03-07 9:25 ` yangerkun
2018-03-07 11:14 ` Amir Goldstein
2018-03-07 11:20 ` Amir Goldstein
2018-03-08 2:38 ` yangerkun
2018-03-08 7:51 ` Amir Goldstein
2018-03-20 16:44 ` Miklos Szeredi
2018-03-20 16:55 ` Jeff Layton [this message]
2018-03-08 2:32 ` yangerkun
2018-03-08 7:37 ` Amir Goldstein
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=1521564929.4686.21.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miaoxie@huawei.com \
--cc=miklos@szeredi.hu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.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