mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 01:08:13 -04:00
Merge tag 'pull-d_add' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull dentry d_add() cleanups from Al Viro: "This converts a bunch of unidiomatic uses of d_add() in ->lookup() instances to equivalent uses of d_splice_alias(), which is the normal mechanism for ->lookup()" * tag 'pull-d_add' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: gfs2: use d_splice_alias() for ->lookup() return value ntfs: use d_splice_alias() for ->lookup() return value simple_lookup(): use d_splice_alias() for ->lookup() return value ecryptfs: use d_splice_alias() for ->lookup() return value configfs_lookup(): switch to d_splice_alias() tracefs: use d_splice_alias() in ->lookup() instances
This commit is contained in:
@@ -501,8 +501,7 @@ static struct dentry * configfs_lookup(struct inode *dir,
|
||||
}
|
||||
spin_unlock(&configfs_dirent_lock);
|
||||
done:
|
||||
d_add(dentry, inode);
|
||||
return NULL;
|
||||
return d_splice_alias(inode, dentry);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -350,11 +350,9 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
|
||||
*/
|
||||
lower_inode = READ_ONCE(lower_dentry->d_inode);
|
||||
|
||||
if (!lower_inode) {
|
||||
/* We want to add because we couldn't find in lower */
|
||||
d_add(dentry, NULL);
|
||||
return NULL;
|
||||
}
|
||||
if (!lower_inode) /* We want to add because we couldn't find in lower */
|
||||
return d_splice_alias(NULL, dentry);
|
||||
|
||||
inode = __ecryptfs_get_inode(lower_inode, dentry->d_sb);
|
||||
if (IS_ERR(inode)) {
|
||||
printk(KERN_ERR "%s: Error interposing; rc = [%ld]\n",
|
||||
|
||||
@@ -994,12 +994,8 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
|
||||
int error;
|
||||
|
||||
inode = gfs2_lookupi(dir, &dentry->d_name, 0);
|
||||
if (inode == NULL) {
|
||||
d_add(dentry, NULL);
|
||||
return NULL;
|
||||
}
|
||||
if (IS_ERR(inode))
|
||||
return ERR_CAST(inode);
|
||||
if (inode == NULL || IS_ERR(inode))
|
||||
return d_splice_alias(inode, dentry);
|
||||
|
||||
gl = GFS2_I(inode)->i_gl;
|
||||
error = gfs2_glock_nq_init(gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
|
||||
|
||||
@@ -78,8 +78,7 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned
|
||||
if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir))
|
||||
return NULL;
|
||||
|
||||
d_add(dentry, NULL);
|
||||
return NULL;
|
||||
return d_splice_alias(NULL, dentry);
|
||||
}
|
||||
EXPORT_SYMBOL(simple_lookup);
|
||||
|
||||
|
||||
@@ -230,9 +230,8 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
|
||||
if (MREF_ERR(mref) == -ENOENT) {
|
||||
ntfs_debug("Entry was not found, adding negative dentry.");
|
||||
/* The dcache will handle negative entries. */
|
||||
d_add(dent, NULL);
|
||||
ntfs_debug("Done.");
|
||||
return NULL;
|
||||
return d_splice_alias(NULL, dent);
|
||||
}
|
||||
ntfs_error(vol->sb, "ntfs_lookup_ino_by_name() failed with error code %i.",
|
||||
-MREF_ERR(mref));
|
||||
|
||||
@@ -389,8 +389,7 @@ static struct dentry *lookup_file(struct eventfs_inode *parent_ei,
|
||||
// Files have their parent's ei as their fsdata
|
||||
dentry->d_fsdata = get_ei(parent_ei);
|
||||
|
||||
d_add(dentry, inode);
|
||||
return NULL;
|
||||
return d_splice_alias(inode, dentry);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -420,8 +419,7 @@ static struct dentry *lookup_dir_entry(struct dentry *dentry,
|
||||
|
||||
dentry->d_fsdata = get_ei(ei);
|
||||
|
||||
d_add(dentry, inode);
|
||||
return NULL;
|
||||
return d_splice_alias(inode, dentry);
|
||||
}
|
||||
|
||||
static inline struct eventfs_inode *init_ei(struct eventfs_inode *ei, const char *name)
|
||||
|
||||
Reference in New Issue
Block a user