Skip to content

Commit abfc0ec

Browse files
Al Virogregkh
Al Viro
authored andcommitted
root dentries need RCU-delayed freeing
commit 90bad5e upstream. Since mountpoint crossing can happen without leaving lazy mode, root dentries do need the same protection against having their memory freed without RCU delay as everything else in the tree. It's partially hidden by RCU delay between detaching from the mount tree and dropping the vfsmount reference, but the starting point of pathwalk can be on an already detached mount, in which case umount-caused RCU delay has already passed by the time the lazy pathwalk grabs rcu_read_lock(). If the starting point happens to be at the root of that vfsmount *and* that vfsmount covers the entire filesystem, we get trouble. Fixes: 48a066e ("RCU'd vsfmounts") Cc: [email protected] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b7722f4 commit abfc0ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/dcache.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,10 +1922,12 @@ struct dentry *d_make_root(struct inode *root_inode)
19221922

19231923
if (root_inode) {
19241924
res = __d_alloc(root_inode->i_sb, NULL);
1925-
if (res)
1925+
if (res) {
1926+
res->d_flags |= DCACHE_RCUACCESS;
19261927
d_instantiate(res, root_inode);
1927-
else
1928+
} else {
19281929
iput(root_inode);
1930+
}
19291931
}
19301932
return res;
19311933
}

0 commit comments

Comments
 (0)