Summary:
Indicate whether the file is currently locked by adding a new field locked to filep.
0 - Unlocked
1 - Locked
The status of the filep at close is used to determine whether to continue with the following procedure.
Optimizing performance:
Before
Time taken to close the file: 33984 nsec
After
Time taken to close the file: 23744 nsec
Improvement of about 10 msec
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
When we close a socket fd, it will call get path on sockets.
`close(socket_fd)` -> `file_closelk(filep)` -> `file_fcntl(F_GETPATH)`
It causes a heavy stack load for each socket close operation.
(We have `GETPATH` for sockets to be used for `fdinfo`)
But the socket fds are not intended to be used for file locks.
And so do some other file types, so we may just limit the usage of flock.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>