linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Kevin Locke <kevin@kevinlocke.name>,
	overlayfs <linux-unionfs@vger.kernel.org>
Subject: Re: EIO for removed redirected files?
Date: Mon, 17 Aug 2020 09:56:51 -0400	[thread overview]
Message-ID: <20200817135651.GA637139@redhat.com> (raw)
In-Reply-To: <CAOQ4uxi23Zsmfb4rCed1n=On0NNA5KZD74jjjeyz+et32sk-gg@mail.gmail.com>

On Wed, Aug 12, 2020 at 08:06:34PM +0300, Amir Goldstein wrote:
> On Wed, Aug 12, 2020 at 7:05 PM Kevin Locke <kevin@kevinlocke.name> wrote:
> >
> > Thanks for the quick response Amir!
> >
> > On Wed, 2020-08-12 at 18:21 +0300, Amir Goldstein wrote:
> > > On Wed, Aug 12, 2020 at 5:06 PM Kevin Locke <kevin@kevinlocke.name> wrote:
> > >> I recently encountered files on an overlayfs which returned EIO
> > >> (Input/output error) for open, stat, and unlink (and presumably other)
> > >> syscalls.  I eventually determined that the files had been redirected
> > >
> > > It's *empty* redirected files that cause the alleged problem.
> >
> > When I replace `touch foo.txt` with `echo 123 > foo.txt` I observe the
> > same behavior.  If I understand you correctly, you are saying that EIO
> > is correct for non-empty files, but potentially incorrect for empty
> > files (which could be copied rather than redirected, since there is no
> > space saving)?
> >
> 
> I wouldn't call it "incorrect" more like "unnecessary".
> 
> > >> At this point, the only way to recover appears to be unmounting the
> > >> overlay and removing the file from upper (or updating the
> > >> overlay.redirect xattr to a valid location).  Is that correct?
> > >>
> > >> Is this the intended behavior?
> > >
> > > Yes.
> > > What would you expect to happen when data of metacopy file has been removed?
> >
> > After reflection, EIO probably makes the most sense for open/stat.  It
> > might be nice to be able to unlink the file to allow recovery (in the
> > sense of being able to reuse the name) without unmounting the overlay,
> 
> It would be nice, but somebody needs to care enough to implement it
> and it is not going to be trivial, because error on lookup is much easier
> then selective error on a "broken" dentry depending on the operation...
> 
> > but the documentation updates may be sufficient to keep users from
> > getting into this state.
> >
> > >> unionmount-testsuite.  If so, perhaps the behavior could be noted in
> > >> "Changes to underlying filesystems" in
> > >> Documentation/filesystems/overlayfs.rst?  I'd be willing to write a
> > >> first draft.  (I doubt I understand it well enough to get everything
> > >> right on the first try.)
> > >
> > > I guess the only thing we could document is that changes to underlying
> > > layers with metacopy and redirects have undefined results.
> > > Vivek was a proponent of making the statements about outcome of
> > > changes to underlying layers sound more harsh.
> >
> > That sounds good to me.  My current use case involves offline changes to
> > the lower layer on a routine basis, and I interpreted the current
> 
> You are not the only one, I hear of many users that do that, but nobody ever
> bothered to sit down and document the requirements - what exactly is the
> use case and what is the expected outcome.
> 
> > wording "Offline changes, when the overlay is not mounted, are allowed
> > to either the upper or the lower trees." to mean that such offline
> > modifications would not break things in unexpected ways.
> >
> 
> The truth is that this documentation is old, before all the new features
> were added. See here [1], Vivek suggested:
> "Modifying/recreating lower layer only works when
>  metacopy/index/nfs_export are not enabled at any point of time. This
>  also will change inode number reporting behavior."
> 
> > In retrospect, I should have expected this behavior, but as someone
> > previously unfamiliar with overlayfs, I hadn't considered that metacopy
> > results in file redirects and that if the underlying file were removed
> > without removing any redirects pointing to it that it would manifest in
> > this way and be so difficult to clean up.
> >
> > If metacopy and dir_redirect are disabled, are offline modifications to
> > the lower layer permitted, or could any such modification result in
> > undefined behavior?
> >
> 
> With metacopy/index/nfs_export/redirect_dir disabled code behaves mostly
> like it did at the time that this documentation was written, so I guess you may
> say that changes are permitted and result in "defined" behavior.

I still think that we should make it clear in documentation that
modifying and recreating lower layers is not allowed when advanced
features like metacopy/index/nfs_export/redirect_dir are enabled. If
one does so, expect the unexpected.

https://lore.kernel.org/linux-unionfs/20200709153616.GE150543@redhat.com/T/#t

To me, if we allow any random modification/recreation of lower filesystem,
then definiting the behavior in all the corner cases becomes hard and
it also makes design of overlayfs more complicated because anytime you
are implementing something, now you have to worry about modifications to
lower layer as well.

And I am also not aware of any good use cases which justify supporting
lower layer modification with new features. So remain of the opinion
that don't support it.

Thanks
Vivek


      parent reply	other threads:[~2020-08-17 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 13:55 EIO for removed redirected files? Kevin Locke
2020-08-12 15:21 ` Amir Goldstein
2020-08-12 16:05   ` Kevin Locke
2020-08-12 17:06     ` Amir Goldstein
2020-08-13 17:22       ` Kevin Locke
2020-08-14  6:20         ` Amir Goldstein
2020-08-17 13:56       ` Vivek Goyal [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=20200817135651.GA637139@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=kevin@kevinlocke.name \
    --cc=linux-unionfs@vger.kernel.org \
    /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).