From mboxrd@z Thu Jan 1 00:00:00 1970 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 6FA6730E826; Thu, 28 Aug 2025 14:50:10 +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=1756392610; cv=none; b=pylFWeUOdlzk2cuVk4+IjsTWt/Fezigj4Oe0KEJoSxMnf3/iiOC1kWHdvGvbxszxt6gC6TlLBcWhA2JVMkHASTPB3hC+X356vOjX220ygdt+kIq7AtHmnMEZkp9Oo2Xb0Bd0OEVRvW3v0TcVuEN4X2ssbNMBvsxE6tmvkeYo5aM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756392610; c=relaxed/simple; bh=GYJ3KjR6oBptzfjIbDDdGIvKL8Wsfza9rukUbaq+S/o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CbpofWqbMzi83y4RQShKd+QlBCt/SoZE7i26MeIoAbKXfuXQB72EnIaODSIIFZ1G4AMNtkfRH6zaqjuHJ5319YGGHyVsCgEGfJ4SDxjKY7knQJBmNJLptkPLkwjYSjWqPcbkYeu9qXY0CWAnrHqvcNCxxk066r8TRGAKl5dMJOM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iEgNcF2M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iEgNcF2M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A4F6C4CEEB; Thu, 28 Aug 2025 14:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756392610; bh=GYJ3KjR6oBptzfjIbDDdGIvKL8Wsfza9rukUbaq+S/o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iEgNcF2Mg9jlnqGrqAa24AQdzyKSyDjr6D6rfU3GcHoo03PACwFJn6lc+ylTY2wcj dBL7vjy1KGs+8r1Ad1N7XoUbJG5jskpSehEa2+Jj57L9eU57KT8ZCMfApK7LTGFKts h4rGdwHyseiDNPB9nEBNOIv9t4py2/mgUqL9hnP49zYXlPFXCPH5e8Afy+e2ovikvu 4TXso1EjCivUZP+QVlxlP02H5aTnoKkZ94ODWrttqKlXzMlrwwNVDi12XptDLNIAAl qvTQI31Iqb6vEm5LontN2XqBzCuF3rIcSDBU6oqLcV/uf5jR2HaPe5zU0UcjLpt61g s+sosEvSf9LRQ== Date: Thu, 28 Aug 2025 07:50:09 -0700 From: "Darrick J. Wong" To: Andrey Albershteyn Cc: fstests@vger.kernel.org, zlang@redhat.com, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Andrey Albershteyn Subject: Re: [PATCH v2 2/3] generic: introduce test to test file_getattr/file_setattr syscalls Message-ID: <20250828145009.GF8096@frogsfrogsfrogs> References: <20250827-xattrat-syscall-v2-0-ba489b5bc17a@kernel.org> <20250827-xattrat-syscall-v2-2-ba489b5bc17a@kernel.org> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250827-xattrat-syscall-v2-2-ba489b5bc17a@kernel.org> On Wed, Aug 27, 2025 at 05:16:16PM +0200, Andrey Albershteyn wrote: > Add a test to test basic functionality of file_getattr() and > file_setattr() syscalls. Most of the work is done in file_attr > utility. > > Signed-off-by: Andrey Albershteyn Looks decent, Reviewed-by: "Darrick J. Wong" --D > --- > tests/generic/2000 | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ > tests/generic/2000.out | 37 +++++++++++++++++ > 2 files changed, 146 insertions(+) > > diff --git a/tests/generic/2000 b/tests/generic/2000 > new file mode 100755 > index 000000000000..b03e9697bb14 > --- /dev/null > +++ b/tests/generic/2000 > @@ -0,0 +1,109 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2025 Red Hat Inc. All Rights Reserved. > +# > +# FS QA Test No. 2000 > +# > +# Test file_getattr/file_setattr syscalls > +# > +. ./common/preamble > +_begin_fstest auto > + > +. ./common/filter > + > +# Modify as appropriate. > +_require_scratch > +_require_test_program "af_unix" > +_require_test_program "file_attr" > +_require_symlinks > +_require_mknod > + > +_scratch_mkfs >>$seqres.full 2>&1 > +_scratch_mount > + > +file_attr () { > + $here/src/file_attr $* > +} > + > +create_af_unix () { > + $here/src/af_unix $* || echo af_unix failed > +} > + > +projectdir=$SCRATCH_MNT/prj > + > +# Create normal files and special files > +mkdir $projectdir > +mkfifo $projectdir/fifo > +mknod $projectdir/chardev c 1 1 > +mknod $projectdir/blockdev b 1 1 > +create_af_unix $projectdir/socket > +touch $projectdir/foo > +ln -s $projectdir/foo $projectdir/symlink > +touch $projectdir/bar > +ln -s $projectdir/bar $projectdir/broken-symlink > +rm -f $projectdir/bar > + > +echo "Error codes" > +# wrong AT_ flags > +file_attr --get --invalid-at $projectdir ./foo > +file_attr --set --invalid-at $projectdir ./foo > +# wrong fsxattr size (too big, too small) > +file_attr --get --too-big-arg $projectdir ./foo > +file_attr --get --too-small-arg $projectdir ./foo > +file_attr --set --too-big-arg $projectdir ./foo > +file_attr --set --too-small-arg $projectdir ./foo > +# out of fsx_xflags mask > +file_attr --set --new-fsx-flag $projectdir ./foo > + > +echo "Initial attributes state" > +file_attr --get $projectdir | _filter_scratch > +file_attr --get $projectdir ./fifo > +file_attr --get $projectdir ./chardev > +file_attr --get $projectdir ./blockdev > +file_attr --get $projectdir ./socket > +file_attr --get $projectdir ./foo > +file_attr --get $projectdir ./symlink > + > +echo "Set FS_XFLAG_NODUMP (d)" > +file_attr --set --set-nodump $projectdir > +file_attr --set --set-nodump $projectdir ./fifo > +file_attr --set --set-nodump $projectdir ./chardev > +file_attr --set --set-nodump $projectdir ./blockdev > +file_attr --set --set-nodump $projectdir ./socket > +file_attr --set --set-nodump $projectdir ./foo > +file_attr --set --set-nodump $projectdir ./symlink > + > +echo "Read attributes" > +file_attr --get $projectdir | _filter_scratch > +file_attr --get $projectdir ./fifo > +file_attr --get $projectdir ./chardev > +file_attr --get $projectdir ./blockdev > +file_attr --get $projectdir ./socket > +file_attr --get $projectdir ./foo > +file_attr --get $projectdir ./symlink > + > +echo "Set attribute on broken link with AT_SYMLINK_NOFOLLOW" > +file_attr --set --set-nodump $projectdir ./broken-symlink > +file_attr --get $projectdir ./broken-symlink > + > +file_attr --set --no-follow --set-nodump $projectdir ./broken-symlink > +file_attr --get --no-follow $projectdir ./broken-symlink > + > +cd $SCRATCH_MNT > +touch ./foo2 > +echo "Initial state of foo2" > +file_attr --get --at-cwd ./foo2 > +echo "Set attribute relative to AT_FDCWD" > +file_attr --set --at-cwd --set-nodump ./foo2 > +file_attr --get --at-cwd ./foo2 > + > +echo "Set attribute on AT_FDCWD" > +mkdir ./bar > +file_attr --get --at-cwd ./bar > +cd ./bar > +file_attr --set --at-cwd --set-nodump "" > +file_attr --get --at-cwd . > + > +# success, all done > +status=0 > +exit > diff --git a/tests/generic/2000.out b/tests/generic/2000.out > new file mode 100644 > index 000000000000..11b1fcbb630b > --- /dev/null > +++ b/tests/generic/2000.out > @@ -0,0 +1,37 @@ > +QA output created by 2000 > +Error codes > +Can not get fsxattr on ./foo: Invalid argument > +Can not get fsxattr on ./foo: Invalid argument > +Can not get fsxattr on ./foo: Argument list too long > +Can not get fsxattr on ./foo: Invalid argument > +Can not get fsxattr on ./foo: Argument list too long > +Can not get fsxattr on ./foo: Invalid argument > +Can not set fsxattr on ./foo: Invalid argument > +Initial attributes state > +----------------- SCRATCH_MNT/prj > +----------------- ./fifo > +----------------- ./chardev > +----------------- ./blockdev > +----------------- ./socket > +----------------- ./foo > +----------------- ./symlink > +Set FS_XFLAG_NODUMP (d) > +Read attributes > +------d---------- SCRATCH_MNT/prj > +------d---------- ./fifo > +------d---------- ./chardev > +------d---------- ./blockdev > +------d---------- ./socket > +------d---------- ./foo > +------d---------- ./symlink > +Set attribute on broken link with AT_SYMLINK_NOFOLLOW > +Can not get fsxattr on ./broken-symlink: No such file or directory > +Can not get fsxattr on ./broken-symlink: No such file or directory > +------d---------- ./broken-symlink > +Initial state of foo2 > +----------------- ./foo2 > +Set attribute relative to AT_FDCWD > +------d---------- ./foo2 > +Set attribute on AT_FDCWD > +----------------- ./bar > +------d---------- . > > -- > 2.49.0 > >