All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Eric Sandeen <sandeen@sandeen.net>,
	Paolo Bonzini <pbonzini@redhat.com>,
	linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: XFS: Assertion failed: !(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE))
Date: Tue, 30 Nov 2021 11:37:08 +0100	[thread overview]
Message-ID: <CAJfpegtjYuAhkpoz5DHD2ZYVd8m+rSWMs6wwA+iXYo=CeJF6Qg@mail.gmail.com> (raw)
In-Reply-To: <CAOQ4uxhkFYZ-TpEooEr_A0_ADdZ8nCff-4NZS8gCU9dd0b2ixQ@mail.gmail.com>

On Tue, 30 Nov 2021 at 06:21, Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Mon, Nov 29, 2021 at 11:33 PM Eric Sandeen <sandeen@sandeen.net> wrote:
> >
> > On 11/26/21 9:56 AM, Paolo Bonzini wrote:
> > > Hi all,
> > >
> > > I have reached the following ASSERT today running a kernel from
> > > git commit 5d9f4cf36721:
> > >
> > >          /*
> > >           * If we are doing a whiteout operation, allocate the whiteout inode
> > >           * we will be placing at the target and ensure the type is set
> > >           * appropriately.
> > >           */
> > >          if (flags & RENAME_WHITEOUT) {
> > >                  ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
> > >                  error = xfs_rename_alloc_whiteout(mnt_userns, target_dp, &wip);
> > >                  if (error)
> > >                          return error;
> > >
> > >                  /* setup target dirent info as whiteout */
> > >                  src_name->type = XFS_DIR3_FT_CHRDEV;
> > >          }
> >
> >
> > Hmm.  Is our ASSERT correct?  rename(2) says:
> >
> > RENAME_NOREPLACE can't be employed together with RENAME_EXCHANGE.
> > RENAME_WHITEOUT  can't be employed together with RENAME_EXCHANGE.
> >
> > do_renameat2() does enforce this:
> >
> >          if ((flags & (RENAME_NOREPLACE | RENAME_WHITEOUT)) &&
> >              (flags & RENAME_EXCHANGE))
> >                  goto put_names;
> >
> > but our assert seems to check for something different: that neither
> > NOREPLACE nor EXCHANGE is employed with WHITEOUT. Is that a thinko?
>
> Probably.
>
> RENAME_NOREPLACE and RENAME_WHITEOUT are independent -
> The former has to do with the target and enforced by generic vfs.
> The latter has to do with the source and is implemented by specific fs.
>
> Overlayfs adds RENAME_WHITEOUT flag is some cases to a rename
> before performing it on underlying fs (i.e. xfs) to leave a whiteout instead
> of the renamed path, so renameat2(NOREPLACE) on overlayfs could
> end up with (RENAME_NOREPLACE | RENAME_WHITEOUT) to xfs.

Agreed, the assert makes no sense.

Thanks,
Miklos

  reply	other threads:[~2021-11-30 10:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 17:56 XFS: Assertion failed: !(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)) Paolo Bonzini
2021-11-28 23:38 ` Eric Sandeen
2021-11-30  5:21   ` Amir Goldstein
2021-11-30 10:37     ` Miklos Szeredi [this message]
2021-12-01  5:10       ` Eric Sandeen

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='CAJfpegtjYuAhkpoz5DHD2ZYVd8m+rSWMs6wwA+iXYo=CeJF6Qg@mail.gmail.com' \
    --to=miklos@szeredi.hu \
    --cc=amir73il@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sandeen@sandeen.net \
    /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.