Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9049376 authored by Al Viro's avatar Al Viro
Browse files

make d_splice_alias(ERR_PTR(err), dentry) = ERR_PTR(err)



... and simplify the living hell out of callers

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0c1aa9a9
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -4079,13 +4079,7 @@ static int btrfs_dentry_delete(const struct dentry *dentry)
static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
				   struct nameidata *nd)
{
	struct inode *inode;

	inode = btrfs_lookup_dentry(dir, dentry);
	if (IS_ERR(inode))
		return ERR_CAST(inode);

	return d_splice_alias(inode, dentry);
	return d_splice_alias(btrfs_lookup_dentry(dir, dentry), dentry);
}

unsigned char btrfs_filetype_table[] = {
+3 −0
Original line number Diff line number Diff line
@@ -1652,6 +1652,9 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
{
	struct dentry *new = NULL;

	if (IS_ERR(inode))
		return ERR_CAST(inode);

	if (inode && S_ISDIR(inode->i_mode)) {
		spin_lock(&inode->i_lock);
		new = __d_find_alias(inode, 1);
+2 −5
Original line number Diff line number Diff line
@@ -63,11 +63,8 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei
	struct inode *inode = NULL;

	inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len);
	if (inodenum) {
	if (inodenum)
		inode = efs_iget(dir->i_sb, inodenum);
		if (IS_ERR(inode))
			return ERR_CAST(inode);
	}

	return d_splice_alias(inode, dentry);
}
+1 −6
Original line number Diff line number Diff line
@@ -55,12 +55,7 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry,
		return ERR_PTR(-ENAMETOOLONG);

	ino = exofs_inode_by_name(dir, dentry);
	inode = NULL;
	if (ino) {
		inode = exofs_iget(dir->i_sb, ino);
		if (IS_ERR(inode))
			return ERR_CAST(inode);
	}
	inode = ino ? exofs_iget(dir->i_sb, ino) : NULL;
	return d_splice_alias(inode, dentry);
}

+5 −9
Original line number Diff line number Diff line
@@ -67,15 +67,11 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str
	inode = NULL;
	if (ino) {
		inode = ext2_iget(dir->i_sb, ino);
		if (IS_ERR(inode)) {
			if (PTR_ERR(inode) == -ESTALE) {
		if (inode == ERR_PTR(-ESTALE)) {
			ext2_error(dir->i_sb, __func__,
					"deleted inode referenced: %lu",
					(unsigned long) ino);
			return ERR_PTR(-EIO);
			} else {
				return ERR_CAST(inode);
			}
		}
	}
	return d_splice_alias(inode, dentry);
Loading