#include "include/filepath.h"
#include "mds/mdstypes.h"
#include "include/ceph_features.h"
+#include "mds/cephfs_features.h"
#include "messages/MMDSOp.h"
#include <sys/types.h>
public:
mutable struct ceph_mds_request_head head; /* XXX HACK! */
utime_t stamp;
- bool peer_old_version = false;
+ feature_bitset_t mds_features;
struct Release {
mutable ceph_mds_request_release item;
MClientRequest()
: MMDSOp(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
memset(&head, 0, sizeof(head));
+ head.owner_uid = -1;
+ head.owner_gid = -1;
}
- MClientRequest(int op, bool over=true)
+ MClientRequest(int op, feature_bitset_t features = 0)
: MMDSOp(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
memset(&head, 0, sizeof(head));
head.op = op;
- peer_old_version = over;
+ mds_features = features;
+ head.owner_uid = -1;
+ head.owner_gid = -1;
}
~MClientRequest() final {}
int get_op() const { return head.op; }
unsigned get_caller_uid() const { return head.caller_uid; }
unsigned get_caller_gid() const { return head.caller_gid; }
+ unsigned get_owner_uid() const { return head.owner_uid; }
+ unsigned get_owner_gid() const { return head.owner_gid; }
const std::vector<uint64_t>& get_caller_gid_list() const { return gid_list; }
const std::string& get_path() const { return path.get_path(); }
copy_from_legacy_head(&head, &old_mds_head);
head.version = 0;
+ head.ext_num_retry = head.num_retry;
+ head.ext_num_fwd = head.num_fwd;
+
+ head.owner_uid = head.caller_uid;
+ head.owner_gid = head.caller_gid;
+
/* Can't set the btime from legacy struct */
if (head.op == CEPH_MDS_OP_SETATTR) {
int localmask = head.args.setattr.mask;
* client will just copy the 'head' memory and isn't
* that smart to skip them.
*/
- if (peer_old_version) {
+ if (!mds_features.test(CEPHFS_FEATURE_32BITS_RETRY_FWD)) {
head.version = 1;
+ } else if (!mds_features.test(CEPHFS_FEATURE_HAS_OWNER_UIDGID)) {
+ head.version = 2;
} else {
head.version = CEPH_MDS_REQUEST_HEAD_VERSION;
}
if (features & CEPH_FEATURE_FS_BTIME) {
- encode(head, payload, peer_old_version);
+ encode(head, payload);
} else {
struct ceph_mds_request_head_legacy old_mds_head;
out << "client_request(" << get_orig_source()
<< ":" << get_tid()
<< " " << ceph_mds_op_name(get_op());
+ if (IS_CEPH_MDS_OP_NEWINODE(head.op)) {
+ out << " owner_uid=" << head.owner_uid
+ << ", owner_gid=" << head.owner_gid;
+ }
if (head.op == CEPH_MDS_OP_GETATTR)
out << " " << ccap_string(head.args.getattr.mask);
if (head.op == CEPH_MDS_OP_SETATTR) {