Commit Graph

10 Commits

Author SHA1 Message Date
guohao15
94e9599e5c file_lock:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
chenrun1
271f76590f fs_lock/pathbuffer:Optimize code structure
Summary:
  Adjust code logic

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1
dba77ff043 fslock:Optimize the performance overhead caused by frequent close
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>
2024-08-22 01:54:22 +08:00
chenrun1
c528244f19 fs_lock:Fixed the problem that in multi-threaded situations, the bucket may be deleted by other factors during the search process, resulting in assertion.
hsearch_r(item = (key = 0x61492174,data = ?),action = ?, retval = 0x6266AC44, htab = 0x6159B758) H 1tem = Ckey = 0x61492174, data= :
 · action = ?
  retval = 0x6266AC44
  htab = 0x6159B758
  haad - 0x61616300
  ie= 0×38

file_lock_find_bucket(inline)
  filepath = 0x61492174
  hretvalue = 0x6055991D
  item = (key = 0x61492174, data = 0x0)

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1
0bf2634631 fs_lock:Reduce stack size
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
Yanfeng Liu
ce0c98f0fd fs/lock: prefer nxsched_self for modularity
Use of nxsched_self() is preferred from outside of the sched/ folder.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-09 20:22:02 +08:00
chenrun1
ae730ac246 fs_lock:Avoid deadlock caused by KILL SIGNAL
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
Zhe Weng
14602be4cc fs/lock: Limit inode type for file locks
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>
2024-02-21 13:29:36 -03:00
chenrun1
8cdec83adb fs_locks:Fix getlk's l pid return
When there is no conflicting lock, getlk should not tamper with the l_pid content from the upper layer

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
chenrun1
5c6bd833ed fs_lock:Implementing file locks
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00