Commit 9a7eec48 authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

fuse: adapt to breakup of struct file_lock

Most of the existing APIs have remained the same, but subsystems that
access file_lock fields directly need to reach into struct
file_lock_core now.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20240131-flsplit-v3-39-c6129007ee8d@kernel.orgReviewed-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent a6bf23e1
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/falloc.h> #include <linux/falloc.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/fs.h> #include <linux/fs.h>
#define _NEED_FILE_LOCK_FIELD_MACROS
#include <linux/filelock.h> #include <linux/filelock.h>
#include <linux/splice.h> #include <linux/splice.h>
...@@ -2510,14 +2509,14 @@ static int convert_fuse_file_lock(struct fuse_conn *fc, ...@@ -2510,14 +2509,14 @@ static int convert_fuse_file_lock(struct fuse_conn *fc,
* translate it into the caller's pid namespace. * translate it into the caller's pid namespace.
*/ */
rcu_read_lock(); rcu_read_lock();
fl->fl_pid = pid_nr_ns(find_pid_ns(ffl->pid, fc->pid_ns), &init_pid_ns); fl->c.flc_pid = pid_nr_ns(find_pid_ns(ffl->pid, fc->pid_ns), &init_pid_ns);
rcu_read_unlock(); rcu_read_unlock();
break; break;
default: default:
return -EIO; return -EIO;
} }
fl->fl_type = ffl->type; fl->c.flc_type = ffl->type;
return 0; return 0;
} }
...@@ -2531,10 +2530,10 @@ static void fuse_lk_fill(struct fuse_args *args, struct file *file, ...@@ -2531,10 +2530,10 @@ static void fuse_lk_fill(struct fuse_args *args, struct file *file,
memset(inarg, 0, sizeof(*inarg)); memset(inarg, 0, sizeof(*inarg));
inarg->fh = ff->fh; inarg->fh = ff->fh;
inarg->owner = fuse_lock_owner_id(fc, fl->fl_owner); inarg->owner = fuse_lock_owner_id(fc, fl->c.flc_owner);
inarg->lk.start = fl->fl_start; inarg->lk.start = fl->fl_start;
inarg->lk.end = fl->fl_end; inarg->lk.end = fl->fl_end;
inarg->lk.type = fl->fl_type; inarg->lk.type = fl->c.flc_type;
inarg->lk.pid = pid; inarg->lk.pid = pid;
if (flock) if (flock)
inarg->lk_flags |= FUSE_LK_FLOCK; inarg->lk_flags |= FUSE_LK_FLOCK;
...@@ -2571,8 +2570,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) ...@@ -2571,8 +2570,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
struct fuse_mount *fm = get_fuse_mount(inode); struct fuse_mount *fm = get_fuse_mount(inode);
FUSE_ARGS(args); FUSE_ARGS(args);
struct fuse_lk_in inarg; struct fuse_lk_in inarg;
int opcode = (fl->fl_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK; int opcode = (fl->c.flc_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK;
struct pid *pid = fl->fl_type != F_UNLCK ? task_tgid(current) : NULL; struct pid *pid = fl->c.flc_type != F_UNLCK ? task_tgid(current) : NULL;
pid_t pid_nr = pid_nr_ns(pid, fm->fc->pid_ns); pid_t pid_nr = pid_nr_ns(pid, fm->fc->pid_ns);
int err; int err;
...@@ -2582,7 +2581,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) ...@@ -2582,7 +2581,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
} }
/* Unlock on close is handled by the flush method */ /* Unlock on close is handled by the flush method */
if ((fl->fl_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX) if ((fl->c.flc_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX)
return 0; return 0;
fuse_lk_fill(&args, file, fl, opcode, pid_nr, flock, &inarg); fuse_lk_fill(&args, file, fl, opcode, pid_nr, flock, &inarg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment