History

ceph: stash idmapping in mdsc request

When sending a mds request cephfs will send relevant data for the requested operation. For creation requests the caller's fs{g,u}id is used to set the ownership of the newly created filesystem object. For setattr requests the caller can pass in arbitrary {g,u}id values to which the relevant filesystem object is supposed to be changed. If the caller is performing the relevant operation via an idmapped mount cephfs simply needs to take the idmapping into account when it sends the relevant mds request. In order to support idmapped mounts for cephfs we stash the idmapping whenever they are relevant for the operation for the duration of the request. Since mds requests can be queued and performed asynchronously we make sure to keep the idmapping around and release it once the request has finished. In follow-up patches we will use this to send correct ownership information over the wire. This patch just adds the basic infrastructure to keep the idmapping around. The actual conversion patches are all fairly minimal.

Christian Brauner committed 3 years ago

Commit 9c2df221 parent 1b903442 files · +6 −0Browse files

Unified · Split

2 files
  1. fs/ceph/mds_client.c +5 −0
  2. fs/ceph/mds_client.h +1 −0
fs/ceph/mds_client.c+5−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/bits.h>
1313 #include <linux/ktime.h>
1414 #include <linux/bitmap.h>
15+#include <linux/mnt_idmapping.h>
1516
1617 #include "super.h"
1718 #include "mds_client.h"
@@ -1122,6 +1123,8 @@ void ceph_mdsc_release_request(struct kref *kref) · 1104 unmodified lines
11221123 kfree(req->r_path1);
11231124 kfree(req->r_path2);
11241125 put_cred(req->r_cred);
1126+ if (req->r_mnt_idmap)
1127+ mnt_idmap_put(req->r_mnt_idmap);
11251128 if (req->r_pagelist)
11261129 ceph_pagelist_release(req->r_pagelist);
11271130 kfree(req->r_fscrypt_auth);
@@ -1181,6 +1184,8 @@ static void __register_request(struct ceph_mds_client *mdsc, · 53 unmodified lines
11811184 insert_request(&mdsc->request_tree, req);
11821185
11831186 req->r_cred = get_current_cred();
1187+ if (!req->r_mnt_idmap)
1188+ req->r_mnt_idmap = &nop_mnt_idmap;
11841189
11851190 if (mdsc->oldest_tid == 0 && req->r_op != CEPH_MDS_OP_SETFILELOCK)
11861191 mdsc->oldest_tid = req->r_tid;
fs/ceph/mds_client.h+1−0
@@ -300,6 +300,7 @@ struct ceph_mds_request { · 299 unmodified lines
300300 int r_fmode; /* file mode, if expecting cap */
301301 int r_request_release_offset;
302302 const struct cred *r_cred;
303+ struct mnt_idmap *r_mnt_idmap;
303304 struct timespec64 r_stamp;
304305
305306 /* for choosing which mds to send this request to */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t