[PATCH v5 13/14] ceph: pass idmap to ceph_open/ioctl_set_layout

From: Alexander Mikhalitsyn
Date: Thu Jun 08 2023 - 11:45:11 EST


Pass an idmapping to:
- ceph_open
- ceph_ioctl_set_layout

Cc: Xiubo Li <xiubli@xxxxxxxxxx>
Cc: Jeff Layton <jlayton@xxxxxxxxxx>
Cc: Ilya Dryomov <idryomov@xxxxxxxxx>
Cc: brauner@xxxxxxxxxx
Cc: ceph-devel@xxxxxxxxxxxxxxx
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>
---
fs/ceph/file.c | 2 ++
fs/ceph/ioctl.c | 3 +++
2 files changed, 5 insertions(+)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 0019d5b4ae3c..3c3aacbf900b 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -356,6 +356,7 @@ int ceph_open(struct inode *inode, struct file *file)
struct ceph_mds_client *mdsc = fsc->mdsc;
struct ceph_mds_request *req;
struct ceph_file_info *fi = file->private_data;
+ struct mnt_idmap *idmap = file_mnt_idmap(file);
int err;
int flags, fmode, wanted;

@@ -426,6 +427,7 @@ int ceph_open(struct inode *inode, struct file *file)
ihold(inode);

req->r_num_caps = 1;
+ req->r_mnt_idmap = mnt_idmap_get(idmap);
err = ceph_mdsc_do_request(mdsc, NULL, req);
if (!err)
err = ceph_init_file(inode, file, req->r_fmode);
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index 07be54ecc94d..d3568643d0af 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -113,6 +113,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
req->r_inode = inode;
ihold(inode);
req->r_num_caps = 1;
+ req->r_mnt_idmap = mnt_idmap_get(idmap);

req->r_inode_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_EXCL;

@@ -138,6 +139,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
{
struct inode *inode = file_inode(file);
+ struct mnt_idmap *idmap = file_mnt_idmap(file);
struct ceph_mds_request *req;
struct ceph_ioctl_layout l;
int err;
@@ -159,6 +161,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
req->r_inode = inode;
ihold(inode);
req->r_num_caps = 1;
+ req->r_mnt_idmap = mnt_idmap_get(idmap);

req->r_args.setlayout.layout.fl_stripe_unit =
cpu_to_le32(l.stripe_unit);
--
2.34.1