I've got a server that has a cifs share (Azure storage files) mounted. Sometimes ls is returning slowly (20seconds). After debugging a bit I've so far found that:
- doing
ls /data/some/symlink/directory
return in 20 seconds - going into the /data/some/symlink/directory and then doing
ls .
takes 0.02 seconds - doing
ls /data/original/location/that/symlinkpoints/to/directory
also returns sub second
the 20 second return time for ls seems to be affected by the number of files in the directory. The larger the directory the more time it takes.
This made me think it had something to do with how the symlink was being treated by ls. Like it had to resolve it for every file or something.
In order to debug this I wanted to run ls through strace to see if I could see what the difference was in syscalls between the different cases. However if I run
strace ls /data/some/symlink/directory it also returns sub second suddenly.
Any ideas on why running it through strace is making it fast and how to debug further?