In the mounted directory, opening different hard links of the same file consecutively will result in an error.

lihao

New Member
Joined
Apr 17, 2025
Messages
1
Reaction score
1
Credits
16
path = "/root/file/DEFAULT_DIR/asset123.chr/chr/chr/aaaa/1.jpg"
path2 = "/root/file/DEFAULT_DIR/asset123.chr.v001/chr/chr/aaaa/1.jpg"


with open(path, 'rb') as f:
print("a")

with open(path, 'rb') as f:
print("b")

OSError: [Errno 22] Invalid argument:

If I wait for 2 seconds between opening the first and second files, the error does not occur.If I open the same hard link, there is no error. Opening a hard link of a local file also does not cause an error.

I believe the triggering condition is that the directory needs to be mounted, and the mounted directory contains hard links, which leads to the error.I suspect it is related to Linux's caching mechanism. Please help explain this issue.
 
Last edited:




Follow Linux.org

Staff online

Members online


Top