Subject: Re: linux-next: build failure after merge of the bpf-next tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 13 Sep 2024 13:48:44 +1000

Hi all,

On Fri, 13 Sep 2024 13:45:04 +1000 Stephen Rothwell <[email-masked]> wrote:
>
> After merging the bpf-next tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:

/home/sfr/next/next/fs/xattr.c: In function 'path_getxattrat':
/home/sfr/next/next/fs/xattr.c:832:23: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  832 |                 if (!f.file)
      |                       ^
/home/sfr/next/next/fs/xattr.c:834:29: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  834 |                 audit_file(f.file);
      |                             ^
/home/sfr/next/next/fs/xattr.c:835:49: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  835 |                 return getxattr(file_mnt_idmap(f.file), file_dentry(f.file),
      |                                                 ^
/home/sfr/next/next/fs/xattr.c:835:70: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  835 |                 return getxattr(file_mnt_idmap(f.file), file_dentry(f.file),
      |                                                                      ^
/home/sfr/next/next/fs/xattr.c: In function 'path_listxattrat':
/home/sfr/next/next/fs/xattr.c:952:23: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  952 |                 if (!f.file)
      |                       ^
/home/sfr/next/next/fs/xattr.c:954:29: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  954 |                 audit_file(f.file);
      |                             ^
/home/sfr/next/next/fs/xattr.c:955:47: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
  955 |                 return listxattr(file_dentry(f.file), list, size);
      |                                               ^
/home/sfr/next/next/fs/xattr.c: In function 'do_fremovexattr':
/home/sfr/next/next/fs/xattr.c:1021:15: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
 1021 |         if (!f.file) 
      |               ^
/home/sfr/next/next/fs/xattr.c:1023:21: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
 1023 |         audit_file(f.file);
      |                     ^
/home/sfr/next/next/fs/xattr.c:1031:38: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
 1031 |         error = mnt_want_write_file(f.file);
      |                                      ^
/home/sfr/next/next/fs/xattr.c:1033:53: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
 1033 |                 error = removexattr(file_mnt_idmap(f.file),
      |                                                     ^
/home/sfr/next/next/fs/xattr.c:1034:38: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
 1034 |                                     f.file->f_path.dentry, kname);
      |                                      ^
/home/sfr/next/next/fs/xattr.c:1035:38: error: 'class_fd_t' {aka 'struct fd'} has no member named 'file'
 1035 |                 mnt_drop_write_file(f.file);
      |                                      ^

> Caused by commit
> 
>   1da91ea87aef ("introduce fd_file(), convert all accessors to it.")
> 
> interacting with commits
> 
>   1a61c9d6ec1d ("xattr: handle AT_EMPTY_PATH when setting xattrs")
>   278397b2c592 ("xattr: handle AT_EMPTY_PATH when getting xattrs")
>   5560ab7ee32e ("xattr: handle AT_EMPTY_PATH when listing xattrs")
>   33fce6444e7d ("xattr: handle AT_EMPTY_PATH when removing xattrs")
> 
> I have applied the following patch for today.
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Fri, 13 Sep 2024 13:40:17 +1000
> Subject: [PATCH] fix up 2 for "introduce fd_file(), convert all accessors to it."
> 
> interacting with commits
> 
>   1a61c9d6ec1d ("xattr: handle AT_EMPTY_PATH when setting xattrs")
>   278397b2c592 ("xattr: handle AT_EMPTY_PATH when getting xattrs")
>   5560ab7ee32e ("xattr: handle AT_EMPTY_PATH when listing xattrs")
>   33fce6444e7d ("xattr: handle AT_EMPTY_PATH when removing xattrs")
> 
> from the vfs-brauner tree.
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>
> ---
>  fs/xattr.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/xattr.c b/fs/xattr.c
> index fa992953fa78..f3559ed3279f 100644
> --- a/fs/xattr.c
> +++ b/fs/xattr.c
> @@ -645,7 +645,7 @@ static int do_fsetxattr(int fd, const char __user *name,
>  	int error;
>  
>  	CLASS(fd, f)(fd);
> -	if (!fd_file(f))
> +	if (fd_empty(f))
>  		return -EBADF;
>  
>  	audit_file(fd_file(f));
> @@ -829,10 +829,10 @@ static ssize_t path_getxattrat(int dfd, const char __user *pathname,
>  
>  	if (at_flags & AT_EMPTY_PATH && vfs_empty_path(dfd, pathname)) {
>  		CLASS(fd, f)(dfd);
> -		if (!f.file)
> +		if (fd_empty(f))
>  			return -EBADF;
> -		audit_file(f.file);
> -		return getxattr(file_mnt_idmap(f.file), file_dentry(f.file),
> +		audit_file(fd_file(f));
> +		return getxattr(file_mnt_idmap(fd_file(f)), file_dentry(fd_file(f)),
>  				name, value, size);
>  	}
>  
> @@ -895,7 +895,7 @@ SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
>  	struct fd f = fdget(fd);
>  	ssize_t error = -EBADF;
>  
> -	if (!fd_file(f))
> +	if (fd_empty(f))
>  		return error;
>  	audit_file(fd_file(f));
>  	error = getxattr(file_mnt_idmap(fd_file(f)), fd_file(f)->f_path.dentry,
> @@ -949,10 +949,10 @@ static ssize_t path_listxattrat(int dfd, const char __user *pathname,
>  
>  	if (at_flags & AT_EMPTY_PATH && vfs_empty_path(dfd, pathname)) {
>  		CLASS(fd, f)(dfd);
> -		if (!f.file)
> +		if (fd_empty(f))
>  			return -EBADF;
> -		audit_file(f.file);
> -		return listxattr(file_dentry(f.file), list, size);
> +		audit_file(fd_file(f));
> +		return listxattr(file_dentry(fd_file(f)), list, size);
>  	}
>  
>  	lookup_flags = (at_flags & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;
> @@ -993,7 +993,7 @@ SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
>  	struct fd f = fdget(fd);
>  	ssize_t error = -EBADF;
>  
> -	if (!fd_file(f))
> +	if (fd_empty(f))
>  		return error;
>  	audit_file(fd_file(f));
>  	error = listxattr(fd_file(f)->f_path.dentry, list, size);
> @@ -1018,9 +1018,9 @@ static int do_fremovexattr(int fd, const char __user *name)
>  	int error = -EBADF;
>  
>  	CLASS(fd, f)(fd);
> -	if (!f.file)
> +	if (fd_empty(f))
>  		return error;
> -	audit_file(f.file);
> +	audit_file(fd_file(f));
>  
>  	error = strncpy_from_user(kname, name, sizeof(kname));
>  	if (error == 0 || error == sizeof(kname))
> @@ -1028,11 +1028,11 @@ static int do_fremovexattr(int fd, const char __user *name)
>  	if (error < 0)
>  		return error;
>  
> -	error = mnt_want_write_file(f.file);
> +	error = mnt_want_write_file(fd_file(f));
>  	if (!error) {
> -		error = removexattr(file_mnt_idmap(f.file),
> -				    f.file->f_path.dentry, kname);
> -		mnt_drop_write_file(f.file);
> +		error = removexattr(file_mnt_idmap(fd_file(f)),
> +				    fd_file(f)->f_path.dentry, kname);
> +		mnt_drop_write_file(fd_file(f));
>  	}
>  	return error;
>  }
> @@ -1099,7 +1099,7 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
>  	char kname[XATTR_NAME_MAX + 1];
>  	int error = -EBADF;
>  
> -	if (!fd_file(f))
> +	if (fd_empty(f))
>  		return error;
>  	audit_file(fd_file(f));
>  
> -- 
> 2.45.2

-- 
Cheers,
Stephen Rothwell