ファイルを同時に検索する 2 つのプロセスがあり、このファイルがまだ dcache に存在していないとします。これら 2 つのルックアップは、NULL ( dentry ) をプロセスに返します。
私の質問は、Linux カーネルは、dentry ルックアップが失敗した後、dentry を 1 つだけ作成することをどのように保証するのですか?
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_filp_open
どのようdentries
に作成されているかがわかります。