All of lore.kernel.org
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huawei.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "zhangyi (F)" <yi.zhang@huawei.com>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>, Miao Xie <miaoxie@huawei.com>
Subject: Re: [fsck.overlay RFC PATCH] overlay: add fsck utility
Date: Thu, 8 Mar 2018 10:32:37 +0800	[thread overview]
Message-ID: <3581e04c-f4c7-226a-f88b-ec0ea394aa8d@huawei.com> (raw)
In-Reply-To: <CAOQ4uxge7XzeJPDSdpQYEHH7iQwJD0-t78gHBbKtMUsO0dQrgw@mail.gmail.com>



On 3/7/2018 7:14 PM, Amir Goldstein wrote:
> On Wed, Mar 7, 2018 at 11:25 AM, yangerkun <yangerkun@huawei.com> wrote:
>>
>>
>> On 11/18/2017 1:13 AM, Amir Goldstein wrote:
>>>
>>> [adding fstests in CC with full patch inline to collect wisdom from
>>> other fs developers]
>>>
>>> On Fri, Nov 17, 2017 at 7:49 AM, zhangyi (F) <yi.zhang@huawei.com> wrote:
>>>>
>>>> Hi,
>>
>> [...]
>>>>
>>>>
>>>> Todo
>>>> ====
>>>>
>>>> 1. Overlay filesystem mounted check. Prevent fscking when overlay is
>>>> online. Now, We cannot distinguish mounted directories if overlayfs was
>>>> mounted with relative path.
>>>
>>>
>>> This should be handled by kernel.
>>> We now already grab an advisory exclusive I_OVL_INUSE lock on both
>>> upperdir and workdir.
>>> fsck.overlay can try to open upperdir/workdir with O_EXCL|O_DIRECTORY
>>> and kernel should fail this open if overlayfs is holding the  I_OVL_INUSE.
>>> Read the man page section on O_EXCL and block device. This is how
>>> e2fsck and friends get exclusive access w.r.t mount.
>>>
>>
>> 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.
>>
> 
> Can you list the possible modifications the fsck.overlay can do on lower layer?
> What exactly are we trying to protect from?

A orphan whiteout and invalid redirect in lower layer will be removed 
automatic or ask user.
Since we cannot change anything for lower layer when overlay has been 
mounted, so we need run fsck.overlay first before mount to ensure 
consistency.
> 
>> Maybe we need adopt another way? How about store pwd in ofs.config when we
>> mount the overlay.
>>
> 
> I don't understand what that means.

We can use the parameters passed in by fsck.overlay and current working 
directory to construct absolute path for lower layers and upper layer; 
but when we want to get the information about mounted overlayfs through 
mountinfo, we cannot construct the absolute path of lower layer and 
upper layer without the pwd when we mount an overlayfs.
> 
> Instead of relying on the partial information available in /proc/<pid>/mountinfo
> we can export more interesting information from kernel per overlayfs mount,
> see for example the information available at /proc/fs/ext4/<blockdev>/
> 
> For example, we can expose "layers" information, including the file handle of
> all layers root dir, so fsck.overlay can figure out if any upper/lower
> dir are in-use
> without needing to resolve paths.

> 
> There is probably other interesting information from ofs.config that can
> be exposed this way.
> 
> Instead of <blockdev> (in the ext4 case) the key would have to be the overlayfs
> anonymous dev, which can be read by stat(2) on any overlay directory.

Thanks for your advise, i will think how to realize.
> 
> Thanks,
> Amir.
> 
> .
> 
Thanks,
yangerkun.

  parent reply	other threads:[~2018-03-08  2:32 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
2018-03-08  2:32       ` yangerkun [this message]
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=3581e04c-f4c7-226a-f88b-ec0ea394aa8d@huawei.com \
    --to=yangerkun@huawei.com \
    --cc=amir73il@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=miklos@szeredi.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.