public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: aalbersh@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 4/4] xfs_db: use file_setattr to copy attributes on special files with rdump
Date: Thu, 28 Aug 2025 07:41:35 -0700	[thread overview]
Message-ID: <20250828144135.GD8096@frogsfrogsfrogs> (raw)
In-Reply-To: <20250827-xattrat-syscall-v2-4-82a2d2d5865b@kernel.org>

On Wed, Aug 27, 2025 at 05:15:56PM +0200, Andrey Albershteyn wrote:
> rdump just skipped file attributes on special files as copying wasn't
> possible. Let's use new file_getattr/file_setattr syscalls to copy
> attributes even for special files.
> 
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>

Looks good!
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  db/rdump.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/db/rdump.c b/db/rdump.c
> index 9ff833553ccb..82520e37d713 100644
> --- a/db/rdump.c
> +++ b/db/rdump.c
> @@ -17,6 +17,7 @@
>  #include "field.h"
>  #include "inode.h"
>  #include "listxattr.h"
> +#include "libfrog/file_attr.h"
>  #include <sys/xattr.h>
>  #include <linux/xattr.h>
>  
> @@ -152,6 +153,12 @@ rdump_fileattrs_path(
>  	const struct destdir	*destdir,
>  	const struct pathbuf	*pbuf)
>  {
> +	struct file_attr	fa = {
> +		.fa_extsize	= ip->i_extsize,
> +		.fa_projid	= ip->i_projid,
> +		.fa_cowextsize	= ip->i_cowextsize,
> +		.fa_xflags	= xfs_ip2xflags(ip),
> +	};
>  	int			ret;
>  
>  	ret = fchmodat(destdir->fd, pbuf->path, VFS_I(ip)->i_mode & ~S_IFMT,
> @@ -181,7 +188,18 @@ rdump_fileattrs_path(
>  			return 1;
>  	}
>  
> -	/* Cannot copy fsxattrs until setfsxattrat gets merged */
> +	ret = xfrog_file_setattr(destdir->fd, pbuf->path, NULL, &fa,
> +			AT_SYMLINK_NOFOLLOW);
> +	if (ret) {
> +		if (errno == EOPNOTSUPP || errno == EPERM || errno == ENOTTY)
> +			lost_mask |= LOST_FSXATTR;
> +		else
> +			dbprintf(_("%s%s%s: xfrog_file_setattr %s\n"),
> +					destdir->path, destdir->sep, pbuf->path,
> +					strerror(errno));
> +		if (strict_errors)
> +			return 1;
> +	}
>  
>  	return 0;
>  }
> 
> -- 
> 2.49.0
> 
> 

  reply	other threads:[~2025-08-28 14:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 15:14 Tests for file_getattr()/file_setattr() and xfsprogs update Andrey Albershteyn
2025-08-27 15:15 ` [PATCH v2 0/4] xfsprogs: utilize file_getattr() and file_setattr() Andrey Albershteyn
2025-08-27 15:15   ` [PATCH v2 1/4] libfrog: add wrappers for file_getattr/file_setattr syscalls Andrey Albershteyn
2025-08-28 14:34     ` Darrick J. Wong
2025-12-02 15:37     ` Arkadiusz Miśkiewicz
2025-12-03  6:25       ` Christoph Hellwig
2025-12-03  9:31         ` Andrey Albershteyn
2025-12-04 19:28         ` [PATCH] libfrog: pass correct structure to FS_IOC_FSSETXATTR Arkadiusz Miśkiewicz
2025-12-04 21:11           ` Darrick J. Wong
2025-12-05  8:57           ` Christoph Hellwig
2025-08-27 15:15   ` [PATCH v2 2/4] xfs_quota: utilize file_setattr to set prjid on special files Andrey Albershteyn
2025-08-28 14:39     ` Darrick J. Wong
2025-08-29 15:42       ` Andrey Albershteyn
2025-08-27 15:15   ` [PATCH v2 3/4] xfs_io: make ls/chattr work with " Andrey Albershteyn
2025-08-28 14:40     ` Darrick J. Wong
2025-08-27 15:15   ` [PATCH v2 4/4] xfs_db: use file_setattr to copy attributes on special files with rdump Andrey Albershteyn
2025-08-28 14:41     ` Darrick J. Wong [this message]
2025-08-27 15:16 ` [PATCH v2 0/3] Test file_getattr and file_setattr syscalls Andrey Albershteyn
2025-08-27 15:16   ` [PATCH v2 1/3] file_attr: introduce program to set/get fsxattr Andrey Albershteyn
2025-08-28 14:49     ` Darrick J. Wong
2025-08-27 15:16   ` [PATCH v2 2/3] generic: introduce test to test file_getattr/file_setattr syscalls Andrey Albershteyn
2025-08-28 14:50     ` Darrick J. Wong
2025-08-27 15:16   ` [PATCH v2 3/3] xfs: test quota's project ID on special files Andrey Albershteyn
2025-08-28 14:51     ` Darrick J. Wong

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=20250828144135.GD8096@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=aalbersh@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@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