lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d23323d-9c85-bcfc-ffb8-6477a9ef3c38@suse.com>
Date:   Mon, 30 Jul 2018 11:17:14 +0300
From:   Nikolay Borisov <nborisov@...e.com>
To:     Al Viro <viro@...IV.linux.org.uk>, linux-fsdevel@...r.kernel.org
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Miklos Szeredi <mszeredi@...hat.com>,
        David Sterba <dsterba@...e.cz>,
        linux-btrfs <linux-btrfs@...r.kernel.org>
Subject: Re: [PATCH 14/16] btrfs: simplify btrfs_iget()

[ADDED David Sterba and Linux-btrfs ml to cc. ]

On 30.07.2018 01:04, Al Viro wrote:
> From: Al Viro <viro@...iv.linux.org.uk>
> 
> don't open-code iget_failed(), don't bother with btrfs_free_path(NULL),
> move handling of positive return values of btrfs_lookup_inode() from
> btrfs_read_locked_inode() to btrfs_iget() and kill now obviously pointless
> ASSERT() in there.
> 
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>

Reviewed-by: Nikolay Borisov <nborisov@...e.com>

> ---
>  fs/btrfs/inode.c | 24 ++++++++----------------
>  1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 8f0b2592feb0..388b2dba68a0 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -3610,18 +3610,15 @@ static int btrfs_read_locked_inode(struct inode *inode)
>  		filled = true;
>  
>  	path = btrfs_alloc_path();
> -	if (!path) {
> -		ret = -ENOMEM;
> -		goto make_bad;
> -	}
> +	if (!path)
> +		return -ENOMEM;
>  
>  	memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));
>  
>  	ret = btrfs_lookup_inode(NULL, root, path, &location, 0);
>  	if (ret) {
> -		if (ret > 0)
> -			ret = -ENOENT;
> -		goto make_bad;
> +		btrfs_free_path(path);
> +		return ret;
>  	}
>  
>  	leaf = path->nodes[0];
> @@ -3774,10 +3771,6 @@ static int btrfs_read_locked_inode(struct inode *inode)
>  
>  	btrfs_sync_inode_flags_to_i_flags(inode);
>  	return 0;
> -
> -make_bad:
> -	btrfs_free_path(path);
> -	return ret;
>  }
>  
>  /*
> @@ -5713,11 +5706,10 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
>  			if (new)
>  				*new = 1;
>  		} else {
> -			make_bad_inode(inode);
> -			unlock_new_inode(inode);
> -			iput(inode);
> -			ASSERT(ret < 0);
> -			inode = ERR_PTR(ret < 0 ? ret : -ESTALE);
> +			iget_failed(inode);
> +			if (ret > 0)
> +				ret = -ENOENT;
> +			inode = ERR_PTR(ret);
>  		}
>  	}
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ