aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/mdc/mdc_lib.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-05-21 14:35:12 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-25 18:29:10 +0200
commit18f92a6e3d6bd00941ddfb5837835348f72d39dc (patch)
tree5b8d2921d3e2a2e135e03825365dadbddc0434f1 /drivers/staging/lustre/lustre/mdc/mdc_lib.c
parentstaging: lustre: simplify capability dropping. (diff)
downloadlinux-dev-18f92a6e3d6bd00941ddfb5837835348f72d39dc.tar.xz
linux-dev-18f92a6e3d6bd00941ddfb5837835348f72d39dc.zip
staging: lustre: discard cfs_cap_t, use kernel_cap_t
lustre only sends 32bits of capabilities in on-the-wire RPC calls. It current strips off higher bits and uses a 32bit cfs_cap_t throughout. Though there is a small memory cost, it is cleaner to use kernel_cap_t throughout and only truncate when marshalling data for RPC calls. So this patch replaces cfs_cap_t with kernel_cap_t throughout, and where a cfs_cap_t was previous stored in a __u32, we now store cap.cap[0] instead. With this, we can remove include/linux/libcfs/curproc.h Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/mdc/mdc_lib.c')
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_lib.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index 46eefdc09e3a..d582968987ff 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -49,7 +49,7 @@ static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
b->mbo_gid = from_kgid(&init_user_ns, current_gid());
b->mbo_fsuid = from_kuid(&init_user_ns, current_fsuid());
b->mbo_fsgid = from_kgid(&init_user_ns, current_fsgid());
- b->mbo_capability = cfs_curproc_cap_pack();
+ b->mbo_capability = current_cap().cap[0];
}
void mdc_swap_layouts_pack(struct ptlrpc_request *req,
@@ -126,7 +126,8 @@ void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
/* packing of MDS records */
void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
const void *data, size_t datalen, umode_t mode,
- uid_t uid, gid_t gid, cfs_cap_t cap_effective, __u64 rdev)
+ uid_t uid, gid_t gid, kernel_cap_t cap_effective,
+ __u64 rdev)
{
struct mdt_rec_create *rec;
char *tmp;
@@ -138,7 +139,7 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
rec->cr_opcode = REINT_CREATE;
rec->cr_fsuid = uid;
rec->cr_fsgid = gid;
- rec->cr_cap = cap_effective;
+ rec->cr_cap = cap_effective.cap[0];
rec->cr_fid1 = op_data->op_fid1;
rec->cr_fid2 = op_data->op_fid2;
rec->cr_mode = mode;
@@ -203,7 +204,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
rec->cr_opcode = REINT_OPEN;
rec->cr_fsuid = from_kuid(&init_user_ns, current_fsuid());
rec->cr_fsgid = from_kgid(&init_user_ns, current_fsgid());
- rec->cr_cap = cfs_curproc_cap_pack();
+ rec->cr_cap = current_cap().cap[0];
rec->cr_fid1 = op_data->op_fid1;
rec->cr_fid2 = op_data->op_fid2;
@@ -281,7 +282,7 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
rec->sa_opcode = REINT_SETATTR;
rec->sa_fsuid = from_kuid(&init_user_ns, current_fsuid());
rec->sa_fsgid = from_kgid(&init_user_ns, current_fsgid());
- rec->sa_cap = cfs_curproc_cap_pack();
+ rec->sa_cap = current_cap().cap[0];
rec->sa_suppgid = -1;
rec->sa_fid = op_data->op_fid1;
@@ -350,7 +351,7 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
REINT_RMENTRY : REINT_UNLINK;
rec->ul_fsuid = op_data->op_fsuid;
rec->ul_fsgid = op_data->op_fsgid;
- rec->ul_cap = op_data->op_cap;
+ rec->ul_cap = op_data->op_cap.cap[0];
rec->ul_mode = op_data->op_mode;
rec->ul_suppgid1 = op_data->op_suppgids[0];
rec->ul_suppgid2 = -1;
@@ -372,7 +373,7 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
rec->lk_opcode = REINT_LINK;
rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */
rec->lk_fsgid = op_data->op_fsgid; /* current->fsgid; */
- rec->lk_cap = op_data->op_cap; /* current->cap_effective; */
+ rec->lk_cap = op_data->op_cap.cap[0]; /* current->cap_effective; */
rec->lk_suppgid1 = op_data->op_suppgids[0];
rec->lk_suppgid2 = op_data->op_suppgids[1];
rec->lk_fid1 = op_data->op_fid1;
@@ -423,7 +424,7 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
rec->rn_opcode = REINT_RENAME;
rec->rn_fsuid = op_data->op_fsuid;
rec->rn_fsgid = op_data->op_fsgid;
- rec->rn_cap = op_data->op_cap;
+ rec->rn_cap = op_data->op_cap.cap[0];
rec->rn_suppgid1 = op_data->op_suppgids[0];
rec->rn_suppgid2 = op_data->op_suppgids[1];
rec->rn_fid1 = op_data->op_fid1;