From: Yan, Zheng Date: Fri, 14 Aug 2015 07:04:22 +0000 (+0800) Subject: client: add options to specify caller_{uid,gid} of MClientCaps X-Git-Tag: v10.0.0~123^2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c6ab8de9476ec83fae63522cc4caff19bd6d3bf9;p=ceph.git client: add options to specify caller_{uid,gid} of MClientCaps Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 4f49bb425ab2..1b8849ee45d4 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -266,6 +266,9 @@ Client::Client(Messenger *m, MonClient *mc) _dir_vxattrs_name_size = _vxattrs_calcu_name_size(_dir_vxattrs); _file_vxattrs_name_size = _vxattrs_calcu_name_size(_file_vxattrs); + user_id = cct->_conf->client_user_id; + group_id = cct->_conf->client_group_id; + lru.lru_set_max(cct->_conf->client_cache_size); lru.lru_set_midpoint(cct->_conf->client_cache_mid); @@ -3021,6 +3024,11 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap, flush, cap->mseq, cap_epoch_barrier); + if (user_id >= 0) + m->caller_uid = user_id; + if (group_id >= 0) + m->caller_gid = group_id; + m->head.issue_seq = cap->issue_seq; m->set_tid(flush_tid); @@ -3291,7 +3299,12 @@ void Client::flush_snaps(Inode *in, bool all_again, CapSnap *again) capsnap->flush_tid = ++last_flush_tid; MClientCaps *m = new MClientCaps(CEPH_CAP_OP_FLUSHSNAP, in->ino, in->snaprealm->ino, 0, mseq, - cap_epoch_barrier); + cap_epoch_barrier); + if (user_id >= 0) + m->caller_uid = user_id; + if (group_id >= 0) + m->caller_gid = group_id; + m->set_client_tid(capsnap->flush_tid); m->head.snap_follows = p->first; diff --git a/src/client/Client.h b/src/client/Client.h index 6a92a8a33e4b..4428e653347f 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -262,11 +262,13 @@ class Client : public Dispatcher, public md_config_obs_t { public: void tick(); - protected: +protected: MonClient *monclient; Messenger *messenger; client_t whoami; + int user_id, group_id; + void set_cap_epoch_barrier(epoch_t e); epoch_t cap_epoch_barrier; diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 71a2ebca9e79..7a1980165611 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -354,6 +354,7 @@ OPTION(client_debug_inject_tick_delay, OPT_INT, 0) // delay the client tick for OPTION(client_max_inline_size, OPT_U64, 4096) OPTION(client_inject_release_failure, OPT_BOOL, false) // synthetic client bug for testing OPTION(client_inject_fixed_oldest_tid, OPT_BOOL, false) // synthetic client bug for testing + // note: the max amount of "in flight" dirty data is roughly (max - target) OPTION(fuse_use_invalidate_cb, OPT_BOOL, false) // use fuse 2.8+ invalidate callback to keep page cache consistent OPTION(fuse_allow_other, OPT_BOOL, true) @@ -363,6 +364,9 @@ OPTION(fuse_atomic_o_trunc, OPT_BOOL, true) OPTION(fuse_debug, OPT_BOOL, false) OPTION(fuse_multithreaded, OPT_BOOL, true) OPTION(fuse_require_active_mds, OPT_BOOL, true) // if ceph_fuse requires active mds server + +OPTION(client_user_id, OPT_INT, -1) +OPTION(client_group_id, OPT_INT, -1) OPTION(client_try_dentry_invalidate, OPT_BOOL, true) // the client should try to use dentry invaldation instead of remounting, on kernels it believes that will work for OPTION(client_die_on_failed_remount, OPT_BOOL, true) OPTION(client_check_pool_perm, OPT_BOOL, true)