All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Luis Henriques <lhenriques@suse.de>
Cc: linux-ext4@vger.kernel.org
Subject: Re: fstest generic/696 failure on ext4 fs with quotas+idmap
Date: Thu, 22 Feb 2024 14:26:27 +0100	[thread overview]
Message-ID: <20240222-knast-reifen-953312ce17a9@brauner> (raw)
In-Reply-To: <87jzmxisqm.fsf@suse.de>

On Wed, Feb 21, 2024 at 06:20:49PM +0000, Luis Henriques wrote:
> Hi!
> 
> The fstest generic/696 (and 697) fail on ext4 when the filesystem is
> created with quota support (-O quota).  It's really easy to reproduce, and
> it fails when doing the idmapped tests (setgid_create_umask_idmapped() and
> setgid_create_umask_idmapped_in_userns()).
> 
> The failure happens when the test does an openat() with O_TMPFILE:
> 
>   ext4_tmpfile()
>     __ext4_new_inode()
>       dquot_initialize()
>         dqget()
> 
> and at this point the error occurs:
> 
> 	if (!qid_has_mapping(sb->s_user_ns, qid))
> 		return ERR_PTR(-EINVAL);
> 
> qid is '-1', which is invalid, but I'm failing to understand if it should
> really be invalid or if dqget() should handle this invalid qid some other
> way.  Earlier, __ext4_new_inode() called inode_init_owner(), which indeed
> sets inode->i_uid with '-1'.

I think that's a misanalysis? The dquot_initialize happens to be before
the inode creation for that tmpfile. Anyway, see below.

> 
> I've been trying to figure it out, but it's very tricky to follow all the
> details, so I decided to ask here and see if anyone has any idea.  Is this
> a known issue?  Maybe the issue is with the test itself, and not with
> ext4, quota or idmapped code.

So good new is that it's neither an ext4, quota, or idmapped bug. It's
just the test being broken because openat_tmpfile_supported() is called
after we created an idmapped mount on the idmapped mount which means
that the callers fs{g,u}id might not be mapped. That means
make_kquid_*id() will return INVALID_*ID which will later fail that
check whether the qid is mapped in dqget().

I sent a patch to xfstests with you can ext4 Cced. I've tested it here
and it's fixed. Feel free to test as well.

  parent reply	other threads:[~2024-02-22 13:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 18:20 fstest generic/696 failure on ext4 fs with quotas+idmap Luis Henriques
2024-02-22 13:23 ` [PATCH] vfs: fix check for tmpfile support Christian Brauner
2024-02-22 14:05   ` Luis Henriques
2024-02-25 15:56     ` Zorro Lang
2024-02-26  8:56       ` Luis Henriques
2024-02-22 13:26 ` Christian Brauner [this message]
2024-02-22 13:53   ` fstest generic/696 failure on ext4 fs with quotas+idmap Luis Henriques

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=20240222-knast-reifen-953312ce17a9@brauner \
    --to=brauner@kernel.org \
    --cc=lhenriques@suse.de \
    --cc=linux-ext4@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 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.