Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

filelock: add new locks_wake_up_waiter() helper

Currently the function that does this takes a struct file_lock, but
__locks_wake_up_blocks() deals with both locks and leases. Currently
this works because both file_lock and file_lease have the file_lock_core
at the beginning of the struct, but it's fragile to rely on that.

Add a new locks_wake_up_waiter() function and call that from
__locks_wake_up_blocks().

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/20250602-filelock-6-16-v1-1-7da5b2c930fd@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
d209f6e1 dd765ba8

+7 -2
+1 -1
fs/locks.c
··· 712 712 fl->fl_lmops && fl->fl_lmops->lm_notify) 713 713 fl->fl_lmops->lm_notify(fl); 714 714 else 715 - locks_wake_up(fl); 715 + locks_wake_up_waiter(waiter); 716 716 717 717 /* 718 718 * The setting of flc_blocker to NULL marks the "done"
+6 -1
include/linux/filelock.h
··· 175 175 return fl->c.flc_type == F_WRLCK; 176 176 } 177 177 178 + static inline void locks_wake_up_waiter(struct file_lock_core *flc) 179 + { 180 + wake_up(&flc->flc_wait); 181 + } 182 + 178 183 static inline void locks_wake_up(struct file_lock *fl) 179 184 { 180 - wake_up(&fl->c.flc_wait); 185 + locks_wake_up_waiter(&fl->c); 181 186 } 182 187 183 188 static inline bool locks_can_async_lock(const struct file_operations *fops)