···7272 DCACHE_DISCONNECTED) dentry is allocated and attached.7373 In the case of a directory, care is taken that only one dentry7474 can ever be attached.7575- d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode)7676- will introduce a new dentry into the tree; either the passed-in7777- dentry or a preexisting alias for the given inode (such as an7878- anonymous one created by d_obtain_alias), if appropriate. The two7979- functions differ in their handling of directories with preexisting8080- aliases:8181- d_splice_alias will use any existing IS_ROOT dentry, but it will8282- return -EIO rather than try to move a dentry with a different8383- parent. This is appropriate for local filesystems, which8484- should never see such an alias unless the filesystem is8585- corrupted somehow (for example, if two on-disk directory8686- entries refer to the same directory.)8787- d_materialise_unique will attempt to move any dentry. This is8888- appropriate for distributed filesystems, where finding a8989- directory other than where we last cached it may be a normal9090- consequence of concurrent operations on other hosts.9191- Both functions return NULL when the passed-in dentry is used,9292- following the calling convention of ->lookup.7575+ d_splice_alias(inode, dentry) will introduce a new dentry into the tree;7676+ either the passed-in dentry or a preexisting alias for the given inode7777+ (such as an anonymous one created by d_obtain_alias), if appropriate.7878+ It returns NULL when the passed-in dentry is used, following the calling7979+ convention of ->lookup.938094819582Filesystem Issues
+4
Documentation/filesystems/porting
···463463 of the in-tree instances did). inode_hash_lock is still held,464464 of course, so they are still serialized wrt removal from inode hash,465465 as well as wrt set() callback of iget5_locked().466466+--467467+[mandatory]468468+ d_materialise_unique() is gone; d_splice_alias() does everything you469469+ need now. Remember that they have opposite orders of arguments ;-/
+1-1
fs/9p/vfs_inode.c
···832832 * moved b under k and client parallely did a lookup for833833 * k/b.834834 */835835- res = d_materialise_unique(dentry, inode);835835+ res = d_splice_alias(inode, dentry);836836 if (!res)837837 v9fs_fid_add(dentry, fid);838838 else if (!IS_ERR(res))
···967967 /* dn must be unhashed */968968 if (!d_unhashed(dn))969969 d_drop(dn);970970- realdn = d_materialise_unique(dn, in);970970+ realdn = d_splice_alias(in, dn);971971 if (IS_ERR(realdn)) {972972 pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",973973 PTR_ERR(realdn), dn, in, ceph_vinop(in));
+1-1
fs/cifs/readdir.c
···123123 if (!inode)124124 goto out;125125126126- alias = d_materialise_unique(dentry, inode);126126+ alias = d_splice_alias(inode, dentry);127127 if (alias && !IS_ERR(alias))128128 dput(alias);129129out:
+2-2
fs/fuse/dir.c
···372372 if (inode && get_node_id(inode) == FUSE_ROOT_ID)373373 goto out_iput;374374375375- newent = d_materialise_unique(entry, inode);375375+ newent = d_splice_alias(inode, entry);376376 err = PTR_ERR(newent);377377 if (IS_ERR(newent))378378 goto out_err;···13201320 if (!inode)13211321 goto out;1322132213231323- alias = d_materialise_unique(dentry, inode);13231323+ alias = d_splice_alias(inode, dentry);13241324 err = PTR_ERR(alias);13251325 if (IS_ERR(alias))13261326 goto out;
+1-1
fs/kernfs/dir.c
···807807 }808808809809 /* instantiate and hash dentry */810810- ret = d_materialise_unique(dentry, inode);810810+ ret = d_splice_alias(inode, dentry);811811 out_unlock:812812 mutex_unlock(&kernfs_mutex);813813 return ret;
+2-2
fs/nfs/dir.c
···499499 if (IS_ERR(inode))500500 goto out;501501502502- alias = d_materialise_unique(dentry, inode);502502+ alias = d_splice_alias(inode, dentry);503503 if (IS_ERR(alias))504504 goto out;505505 else if (alias) {···13931393 nfs_advise_use_readdirplus(dir);1394139413951395no_entry:13961396- res = d_materialise_unique(dentry, inode);13961396+ res = d_splice_alias(inode, dentry);13971397 if (res != NULL) {13981398 if (IS_ERR(res))13991399 goto out_unblock_sillyrename;
+1-1
fs/nfs/getroot.c
···5151 /*5252 * Ensure that this dentry is invisible to d_find_alias().5353 * Otherwise, it may be spliced into the tree by5454- * d_materialise_unique if a parent directory from the same5454+ * d_splice_alias if a parent directory from the same5555 * filesystem gets mounted at a later time.5656 * This again causes shrink_dcache_for_umount_subtree() to5757 * Oops, since the test for IS_ROOT() will fail.