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

filelock: convert locks_translate_pid to take file_lock_core

locks_translate_pid is used on both locks and leases, so have that take
struct file_lock_core.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20240131-flsplit-v3-32-c6129007ee8d@kernel.org
Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
ae7eb16e 7c18509b

+10 -10
+10 -10
fs/locks.c
··· 2169 2169 * 2170 2170 * Used to translate a fl_pid into a namespace virtual pid number 2171 2171 */ 2172 - static pid_t locks_translate_pid(struct file_lock *fl, struct pid_namespace *ns) 2172 + static pid_t locks_translate_pid(struct file_lock_core *fl, struct pid_namespace *ns) 2173 2173 { 2174 2174 pid_t vnr; 2175 2175 struct pid *pid; 2176 2176 2177 - if (fl->c.flc_flags & FL_OFDLCK) 2177 + if (fl->flc_flags & FL_OFDLCK) 2178 2178 return -1; 2179 2179 2180 2180 /* Remote locks report a negative pid value */ 2181 - if (fl->c.flc_pid <= 0) 2182 - return fl->c.flc_pid; 2181 + if (fl->flc_pid <= 0) 2182 + return fl->flc_pid; 2183 2183 2184 2184 /* 2185 2185 * If the flock owner process is dead and its pid has been already ··· 2187 2187 * flock owner pid number in init pidns. 2188 2188 */ 2189 2189 if (ns == &init_pid_ns) 2190 - return (pid_t) fl->c.flc_pid; 2190 + return (pid_t) fl->flc_pid; 2191 2191 2192 2192 rcu_read_lock(); 2193 - pid = find_pid_ns(fl->c.flc_pid, &init_pid_ns); 2193 + pid = find_pid_ns(fl->flc_pid, &init_pid_ns); 2194 2194 vnr = pid_nr_ns(pid, ns); 2195 2195 rcu_read_unlock(); 2196 2196 return vnr; ··· 2198 2198 2199 2199 static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl) 2200 2200 { 2201 - flock->l_pid = locks_translate_pid(fl, task_active_pid_ns(current)); 2201 + flock->l_pid = locks_translate_pid(&fl->c, task_active_pid_ns(current)); 2202 2202 #if BITS_PER_LONG == 32 2203 2203 /* 2204 2204 * Make sure we can represent the posix lock via ··· 2220 2220 #if BITS_PER_LONG == 32 2221 2221 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl) 2222 2222 { 2223 - flock->l_pid = locks_translate_pid(fl, task_active_pid_ns(current)); 2223 + flock->l_pid = locks_translate_pid(&fl->c, task_active_pid_ns(current)); 2224 2224 flock->l_start = fl->fl_start; 2225 2225 flock->l_len = fl->fl_end == OFFSET_MAX ? 0 : 2226 2226 fl->fl_end - fl->fl_start + 1; ··· 2726 2726 struct pid_namespace *proc_pidns = proc_pid_ns(file_inode(f->file)->i_sb); 2727 2727 int type = fl->c.flc_type; 2728 2728 2729 - pid = locks_translate_pid(fl, proc_pidns); 2729 + pid = locks_translate_pid(&fl->c, proc_pidns); 2730 2730 /* 2731 2731 * If lock owner is dead (and pid is freed) or not visible in current 2732 2732 * pidns, zero is shown as a pid value. Check lock info from ··· 2819 2819 2820 2820 cur = hlist_entry(v, struct file_lock, c.flc_link); 2821 2821 2822 - if (locks_translate_pid(cur, proc_pidns) == 0) 2822 + if (locks_translate_pid(&cur->c, proc_pidns) == 0) 2823 2823 return 0; 2824 2824 2825 2825 /* View this crossed linked list as a binary tree, the first member of fl_blocked_requests