From: Ben Evans Date: Thu, 25 Jun 2015 19:00:39 +0000 (-0700) Subject: LU-6450 mdd: Remove unused MAY_ constants X-Git-Tag: 2.7.58~16 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=55a61af0d96581d8609f3fcfa582d6d8c9c47f7e LU-6450 mdd: Remove unused MAY_ constants Remove unused MAY_ constants from lustre_idl.h Remove dead code from mdd_permission() Signed-off-by: Ben Evans Change-Id: I722f55eac88c7143555e680f72971b96791b00ae Reviewed-on: http://review.whamcloud.com/15398 Reviewed-by: John L. Hammond Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index afef66f..be88ece 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -2479,23 +2479,6 @@ extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa); MDS_OPEN_BY_FID | MDS_OPEN_LEASE | \ MDS_OPEN_RELEASE) -/* permission for create non-directory file */ -#define MAY_CREATE (1 << 7) -/* permission for create directory file */ -#define MAY_LINK (1 << 8) -/* permission for delete from the directory */ -#define MAY_UNLINK (1 << 9) -/* source's permission for rename */ -#define MAY_RENAME_SRC (1 << 10) -/* target's permission for rename */ -#define MAY_RENAME_TAR (1 << 11) -/* part (parent's) VTX permission check */ -#define MAY_VTX_PART (1 << 12) -/* full VTX permission check */ -#define MAY_VTX_FULL (1 << 13) -/* lfs rgetfacl permission check */ -#define MAY_RGETFACL (1 << 14) - enum mds_op_bias { MDS_CHECK_SPLIT = 1 << 0, MDS_CROSS_REF = 1 << 1, diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 2da5847..0085000 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -98,6 +98,9 @@ typedef enum { MDT_PDO_LOCK = (1 << 1) } mdl_type_t; +/* lfs rgetfacl permission check */ +#define MAY_RGETFACL (1 << 14) + /* memory structure for hsm attributes * for fields description see the on disk structure hsm_attrs * which is defined in lustre_idl.h diff --git a/lustre/mdd/mdd_permission.c b/lustre/mdd/mdd_permission.c index f082d41..2814800 100644 --- a/lustre/mdd/mdd_permission.c +++ b/lustre/mdd/mdd_permission.c @@ -313,12 +313,6 @@ int mdd_permission(const struct lu_env *env, struct lu_ucred *uc = NULL; struct lu_attr *pattr = NULL; struct lu_attr *cattr = MDD_ENV_VAR(env, cattr); - bool check_create; - bool check_link; - int check_unlink; - int check_rename_src, check_rename_tar; - int check_vtx_part, check_vtx_full; - int check_rgetfacl; int rc = 0; ENTRY; @@ -342,57 +336,18 @@ int mdd_permission(const struct lu_env *env, if (unlikely(mask & MDS_OPEN_CROSS)) mask = accmode(env, cattr, mask & ~MDS_OPEN_CROSS); - check_create = mask & MAY_CREATE; - check_link = mask & MAY_LINK; - check_unlink = mask & MAY_UNLINK; - check_rename_src = mask & MAY_RENAME_SRC; - check_rename_tar = mask & MAY_RENAME_TAR; - check_vtx_part = mask & MAY_VTX_PART; - check_vtx_full = mask & MAY_VTX_FULL; - check_rgetfacl = mask & MAY_RGETFACL; - - mask &= ~(MAY_CREATE | MAY_LINK | - MAY_UNLINK | - MAY_RENAME_SRC | MAY_RENAME_TAR | - MAY_VTX_PART | MAY_VTX_FULL | - MAY_RGETFACL); - - rc = mdd_permission_internal_locked(env, mdd_cobj, cattr, mask, - MOR_TGT_CHILD); - - if (!rc && check_create) - rc = mdd_may_create(env, mdd_pobj, pattr, mdd_cobj, true); - - if (!rc && check_unlink) - rc = mdd_may_unlink(env, mdd_pobj, pattr, cattr); - - if (!rc && (check_rename_src || check_rename_tar)) - rc = mdd_may_delete(env, mdd_pobj, pattr, mdd_cobj, cattr, NULL, - 1, check_rename_tar); - - if (!rc && (check_vtx_part || check_vtx_full)) { - uc = lu_ucred_assert(env); - - if (!(cattr->la_mode & S_ISVTX) || - (cattr->la_uid == uc->uc_fsuid) || - (check_vtx_full && (ma->ma_attr.la_valid & LA_UID) && - (ma->ma_attr.la_uid == uc->uc_fsuid))) { - ma->ma_attr_flags |= MDS_VTX_BYPASS; - } else { - ma->ma_attr_flags &= ~MDS_VTX_BYPASS; - if (check_vtx_full) - rc = -EPERM; - } - } + rc = mdd_permission_internal_locked(env, mdd_cobj, cattr, + mask & ~MAY_RGETFACL, + MOR_TGT_CHILD); - if (unlikely(!rc && check_rgetfacl)) { - if (likely(!uc)) + if (unlikely(rc == 0 && (mask & MAY_RGETFACL))) { + if (likely(!uc)) uc = lu_ucred_assert(env); if (cattr->la_uid != uc->uc_fsuid && !md_capable(uc, CFS_CAP_FOWNER)) rc = -EPERM; - } + } - RETURN(rc); + RETURN(rc); }