Re: [PATCH 2/6] shmem: make shmem_get_inode() return ERR_PTR instead of NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 03-04-23 10:47:55, cem@xxxxxxxxxx wrote:
> From: Lukas Czerner <lczerner@xxxxxxxxxx>
> 
> Make shmem_get_inode() return ERR_PTR instead of NULL on error. This will be
> useful later when we introduce quota support.
> 
> There should be no functional change.
> 
> Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
> Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>

One comment below:

> @@ -2958,21 +2967,24 @@ shmem_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
>  	      struct file *file, umode_t mode)
>  {
>  	struct inode *inode;
> -	int error = -ENOSPC;
> +	int error;
>  
>  	inode = shmem_get_inode(idmap, dir->i_sb, dir, mode, 0, VM_NORESERVE);
> -	if (inode) {
> -		error = security_inode_init_security(inode, dir,
> -						     NULL,
> -						     shmem_initxattrs, NULL);
> -		if (error && error != -EOPNOTSUPP)
> -			goto out_iput;
> -		error = simple_acl_create(dir, inode);
> -		if (error)
> -			goto out_iput;
> -		d_tmpfile(file, inode);
> -	}
> +
> +	if (IS_ERR(inode))
> +		return PTR_ERR(inode);

This doesn't look correct. Previously, we've called
finish_open_simple(file, error), now you just return error... Otherwise the
patch looks good to me.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux