From: Greg Farnum Date: Mon, 12 Sep 2016 22:42:26 +0000 (-0700) Subject: client: do a shallow copy for MetaRequest::perms X-Git-Tag: v11.0.1~36^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=24279ef8aaf7ea898df0514891fdb71d78043e6c;p=ceph.git client: do a shallow copy for MetaRequest::perms Signed-off-by: Greg Farnum --- diff --git a/src/client/MetaRequest.h b/src/client/MetaRequest.h index 3d0fc4488fc9..f28f36af8965 100644 --- a/src/client/MetaRequest.h +++ b/src/client/MetaRequest.h @@ -172,7 +172,7 @@ public: void set_filepath2(const filepath& fp) { path2 = fp; } void set_string2(const char *s) { path2.set_path(s, 0); } void set_caller_perms(const UserPerm& _perms) { - perms = _perms; + perms.shallow_copy(_perms); head.caller_uid = perms.uid(); head.caller_gid = perms.gid(); } diff --git a/src/client/UserPerm.h b/src/client/UserPerm.h index b1af6cdaec16..43b5347d2045 100644 --- a/src/client/UserPerm.h +++ b/src/client/UserPerm.h @@ -58,8 +58,7 @@ public: deep_copy(*this, o); return *this; } - // FIXME: stop doing a deep-copy all the time. We need it on stuff - // that lasts longer than a single "syscall", but not for MetaRequests et al + uid_t uid() const { return m_uid; } gid_t gid() const { return m_gid; } bool gid_in_groups(gid_t gid) const { @@ -75,6 +74,13 @@ public: gid_count = count; } void take_gids() { alloced_gids = true; } + void shallow_copy(const UserPerm& o) { + m_uid = o.m_uid; + m_gid = o.m_gid; + gid_count = o.gid_count; + gids = o.gids; + alloced_gids = false; + } }; #endif