Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp334572rdb; Thu, 22 Feb 2024 05:26:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWzohU1DWU+pwgcEODT4S0sr1IYvdSbqiEO9w2Aao/3Vp2GRlLE2NQTRk+AivT2T69VDzu7jrriNQcKOajqq3vY0lxzJjbIB3M2M+HvbA== X-Google-Smtp-Source: AGHT+IGUSgmwiIocZph87EcEp90MgvAq6FgIlm4HAUA3RHRGr5CmqDE/RNSj7gA9SqvzT2LdoMA9 X-Received: by 2002:a0c:cb8a:0:b0:68f:441b:66ea with SMTP id p10-20020a0ccb8a000000b0068f441b66eamr13082525qvk.26.1708608395073; Thu, 22 Feb 2024 05:26:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708608395; cv=pass; d=google.com; s=arc-20160816; b=eoVzctz9PO1j2nka/RXC9gIVaKO10VJwifFXoPlLt/dJPhuO0z1L5D7zaZRFTC7J8u v+S5QKA5hJ+SXee7cfHDoRYUlgVCqn71uFWufwqheNT7t3/8LU25XOgSQe4jQpEH9+Sp NbJbdyc5y3WDCNM2E/VF6CyzhGdawCMDgX3KYWvqJTuK3J2fHbbKdPFuBM9PVkkwL7Mf e3QoWwWKXhWcwj4oaUqUJ8BvoG8kYXe77cpEi7MpEI1pj8FariEfC6jH2A16v7I/Sq+4 w4agBOrm1QzjQPDG+WPk57CGKSmX16dKSrab2zIfKEUd8rybmi1JdlVb2O9O3iaFm+38 xqHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Op2C1rQS7I6j0JN6ccukl6y663MBYBeikqr8uVu7YPM=; fh=owhJ5KjTakq1ShTAdYepkVzevvcwVcWcbZb4UwsV+74=; b=guSDgoMlddLnrv5kj6FMKGDuPZ5ibnzORDedBVfGoMiQH0nz7ZXvNliY4uzTCNrDxX EwPKOX6fNohvfJN7Z+CYtjSORC03y+/2bgUSowKKupJBzFROzAc7Eoc8izUNhaAjqzEZ NhoYSOzc42v5beulcba+HwtAxDrD+OTkPwQpJl/eD0PQsN+GYwML8bJNYgpTjuGRblgR THL37beXXiAoJwIzEqYLUG4CS5Lg/d9QVzKDJAKRduGaRWLRUNWvO9KQwuGiPdJ9WMC/ ot9zCMySZ1RRKe0zFjY7MA3/kV1g60Ji+S6hj4kcMJSp+zBQqw+3drBI1T3HvJ/Def6K 1FUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ksKmIfkf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-ext4+bounces-1359-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h5-20020a0562140da500b0068fa303de0csi3416590qvh.465.2024.02.22.05.26.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:26:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1359-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ksKmIfkf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-ext4+bounces-1359-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CC4F41C2410A for ; Thu, 22 Feb 2024 13:26:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B1D513340A; Thu, 22 Feb 2024 13:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ksKmIfkf" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABD081332AC for ; Thu, 22 Feb 2024 13:26:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708608391; cv=none; b=grFILoDS41yvZ11zxOatvgSv6LpBJL0uLhMJty1R7w5eegO2rHy3O8vDTBpt2qyqLROgcv147pNL/SMGPfW8aYNrs4CsYKQwKWp8OVg8m01pxGDXjAvwFMcoE4Te3nrSeRBpOiqB6HS1YyO+5OJhUbabylRW0+vLQ3Zxqc8EAi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708608391; c=relaxed/simple; bh=izMOQ6q+ygXGACusehygwzpWEZre8yRkB2YiZPA1d08=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IfL+DgHjiyVyCruhFKzS/W5R8sBCjqbqgRUyeItXqZhP+BJPAhJOiTQDA7TDQELgqJRKz5ynzAfT32OpuDiblmpNRYmXY1v6H+FdPOPTsZsm6tNSIgW5siGf27GbLsYxehWq+buZA0eNeAzrbY1ZSQbMThMDknDrVgWUXnWMlYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ksKmIfkf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4F80C433C7; Thu, 22 Feb 2024 13:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708608390; bh=izMOQ6q+ygXGACusehygwzpWEZre8yRkB2YiZPA1d08=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ksKmIfkfqNUeUrOzHnMJNvw0qAhyOEOuVCY+/2bdr107ClW7kUKnNNKy3TNm+RSSm jzx8zGa294IPip1XYzjFWsZjjEU55+5FbVVoy6WPJKqJXQpdVwDlD+3735pRHzSx/n t4mTNu0tYM3oP0vrcSDWKMOW85QcOzDDOp4/UVQFUQiFTdUQ3brCfvxJPHIm2RuR+W t3qZBMhucTDBMXYb79aSaTwuhyRyF+KZyR9Z4MBiGD3K+HdoI8MXyIKs/WTsd97ast czXuJTUx1BUjbiecWtFLFl03Lp550GLinnD+bzzGO0OBOMlBV6W3FRYIJLVoWGcgQX ab6dggA7Er5ag== Date: Thu, 22 Feb 2024 14:26:27 +0100 From: Christian Brauner To: Luis Henriques Cc: linux-ext4@vger.kernel.org Subject: Re: fstest generic/696 failure on ext4 fs with quotas+idmap Message-ID: <20240222-knast-reifen-953312ce17a9@brauner> References: <87jzmxisqm.fsf@suse.de> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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.