The path is stored in the file-> f_path structure, as the name implies. Itβs just not in the form of flat text, but analyzed for objects that are more useful for the kernel to work, namely, a chain of denting structures and a vfsmount structure that points to the root of the current subtree.
You can use the d_path function to regenerate the name for human reading for the structure path, for example file-> f_path. Please note that, however, this is not a cheap operation, and this can significantly slow down your workload.
The above issues with open but unrelated files, multiple hard links, etc. valid for matching and inode with the path name, and the open file always has a path associated with it. If the file was detached, d_path will add "(deleted)" to the name, and if the name of the file that it was open was changed to another, using renaming from the moment it was opened. D_path will not print the original name, but the current name of the record that was used to open it.
source share