From: Vito Caputo <vito.caputo@coreos.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: "linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>
Subject: Re: Stable inode numbers
Date: Mon, 15 Aug 2016 17:03:27 -0700 [thread overview]
Message-ID: <CAKp8XJ4XSenroB+Fa9EEmzCezPGH2Xs3ip9r7qpZP9q5Xzu4tw@mail.gmail.com> (raw)
In-Reply-To: <20160726110940.GA25404@veci.piliscsaba.szeredi.hu>
Miklos,
This most recent patch looks ok to me, and it works fine in my limited testing.
Thanks,
Vito Caputo
On Tue, Jul 26, 2016 at 4:09 AM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> On Tue, Jul 26, 2016 at 12:02:13PM +0200, Miklos Szeredi wrote:
>> On Mon, Jul 25, 2016 at 11:25 PM, Vito Caputo <vito.caputo@coreos.com> wrote:
>> > I think this strategy is an improvement, but I'm a bit apprehensive
>> > about how specific it is to this particular style of untar-like
>> > directory metadata preservation failure in only providing stability to
>> > directory inode numbers.
>> >
>> > Additionally it introduces a userspace-visible mount option, for
>> > something which /feels/ like a stop-gap kludge to make some things
>> > work better in the short-term. Maybe it's acceptable, since a more
>> > general solution could be implemented later which ignores the added
>> > mount option without conflict.
>
> Here's another patch that achieves stability without compromising
> performance/disk usage.
>
> Again not perfect, but perhaps good enough?
>
> Thanks,
> Miklos
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 12bcd07b9e32..5b7de7d489e0 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -143,13 +143,24 @@ static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,
> type = ovl_path_real(dentry, &realpath);
> old_cred = ovl_override_creds(dentry->d_sb);
> err = vfs_getattr(&realpath, stat);
> + /*
> + * Use lower ino/dev for merged dir, so they are stable across copy up.
> + */
> + if (!err && OVL_TYPE_MERGE(type) && OVL_TYPE_UPPER(type)) {
> + struct path lowerpath;
> + struct kstat lowerstat;
> +
> + ovl_path_lower(dentry, &lowerpath);
> + err = vfs_getattr(&lowerpath, &lowerstat);
> + if (!err) {
> + stat->dev = lowerstat.dev;
> + stat->ino = lowerstat.ino;
> + }
> + }
> revert_creds(old_cred);
> if (err)
> return err;
>
> - stat->dev = dentry->d_sb->s_dev;
> - stat->ino = dentry->d_inode->i_ino;
> -
> /*
> * It's probably not worth it to count subdirs to get the
> * correct link count. nlink=1 seems to pacify 'find' and
prev parent reply other threads:[~2016-08-16 0:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 23:33 Stable inode numbers Vito Caputo
2016-07-22 12:15 ` Miklos Szeredi
2016-07-22 20:55 ` Vito Caputo
2016-07-25 11:34 ` Miklos Szeredi
2016-07-25 21:25 ` Vito Caputo
2016-07-26 1:51 ` J. R. Okajima
2016-07-26 10:02 ` Miklos Szeredi
2016-07-26 11:09 ` Miklos Szeredi
2016-08-16 0:03 ` Vito Caputo [this message]
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=CAKp8XJ4XSenroB+Fa9EEmzCezPGH2Xs3ip9r7qpZP9q5Xzu4tw@mail.gmail.com \
--to=vito.caputo@coreos.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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).