Concurrency Linux内核如何处理并发文件查找

Concurrency Linux内核如何处理并发文件查找,concurrency,filesystems,linux-kernel,Concurrency,Filesystems,Linux Kernel,假设有两个进程同时处理一个文件,而这个文件在dcache中还不存在。这两个查找将向进程返回NULL() 我的问题是,Linux内核如何确保在dentry查找失败后,它只创建一个dentry 1912 /** 1913 * d_lookup - search for a dentry 1914 * @parent: parent dentry 1915 * @name: qstr of name we wish to find 1916 * Returns: dentry, or NULL

假设有两个进程同时处理一个文件,而这个文件在dcache中还不存在。这两个查找将向进程返回NULL()

我的问题是,Linux内核如何确保在dentry查找失败后,它只创建一个dentry

1912 /**
1913  * d_lookup - search for a dentry
1914  * @parent: parent dentry
1915  * @name: qstr of name we wish to find
1916  * Returns: dentry, or NULL
1917  *
1918  * d_lookup searches the children of the parent dentry for the name in
1919  * question. If the dentry is found its reference count is incremented and the
1920  * dentry is returned. The caller must use dput to free the entry when it has
1921  * finished using it. %NULL is returned if the dentry does not exist.
1922  */
d_lookup
不会自己创建任何
dentry
对象。查看
do\u filp\u open
逻辑,它显示了如何创建
dentries