X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_open.c;h=97918c48240074a1bdeeabe77ec77ae0a2df3b8e;hb=2bc5bcb7efa247fcd8cc65d013ffc9f6c33dd788;hp=4aacc8c3647a84fcac749ce43f685ffe048d21d5;hpb=48d9e119238fd0c54ff8b6a53f7bfed9d5750a24;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 4aacc8c..97918c4 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2013, Intel Corporation. + * Copyright (c) 2011, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -45,6 +45,7 @@ #include #include #include "mdt_internal.h" +#include /* we do nothing because we do not have refcount now */ static void mdt_mfd_get(void *mfdp) @@ -469,7 +470,7 @@ static int mdt_ioepoch_close(struct mdt_thread_info *info, struct mdt_object *o) * Apply obtained attributes for the 1st case, wipe out the on-disk SOM * cache otherwise. */ -int mdt_som_au_close(struct mdt_thread_info *info, struct mdt_object *o) +static int mdt_som_au_close(struct mdt_thread_info *info, struct mdt_object *o) { struct ptlrpc_request *req = mdt_info_req(info); __u64 ioepoch = 0; @@ -662,9 +663,9 @@ void mdt_mfd_set_mode(struct mdt_file_data *mfd, __u64 mode) /** * prep ma_lmm/ma_lmv for md_attr from reply */ -void mdt_prep_ma_buf_from_rep(struct mdt_thread_info *info, - struct mdt_object *obj, - struct md_attr *ma) +static void mdt_prep_ma_buf_from_rep(struct mdt_thread_info *info, + struct mdt_object *obj, + struct md_attr *ma) { LASSERT(ma->ma_lmv == NULL && ma->ma_lmm == NULL); if (S_ISDIR(obj->mot_header.loh_attr)) { @@ -754,8 +755,18 @@ static int mdt_mfd_open(struct mdt_thread_info *info, struct mdt_object *p, rc = mo_open(info->mti_env, mdt_object_child(o), created ? flags | MDS_OPEN_CREATED : flags); - if (rc) - GOTO(err_out, rc); + if (rc != 0) { + /* If we allow the client to chgrp (CFS_SETGRP_PERM), but the + * client does not know which suppgid should be sent to the MDS, + * or some other(s) changed the target file's GID after this RPC + * sent to the MDS with the suppgid as the original GID, then we + * give the client another chance to send the right suppgid. */ + if (rc == -EACCES && + allow_client_chgrp(info, lu_ucred(info->mti_env))) + mdt_set_disposition(info, rep, DISP_OPEN_DENY); + + GOTO(err_out, rc); + } mfd = mdt_mfd_new(med); if (mfd == NULL) @@ -851,9 +862,9 @@ err_out: return rc; } -int mdt_finish_open(struct mdt_thread_info *info, - struct mdt_object *p, struct mdt_object *o, - __u64 flags, int created, struct ldlm_reply *rep) +static int mdt_finish_open(struct mdt_thread_info *info, + struct mdt_object *p, struct mdt_object *o, + __u64 flags, int created, struct ldlm_reply *rep) { struct ptlrpc_request *req = mdt_info_req(info); struct obd_export *exp = req->rq_export; @@ -904,34 +915,9 @@ int mdt_finish_open(struct mdt_thread_info *info, } } #ifdef CONFIG_FS_POSIX_ACL - else if (exp_connect_flags(exp) & OBD_CONNECT_ACL) { - const struct lu_env *env = info->mti_env; - struct md_object *next = mdt_object_child(o); - struct lu_buf *buf = &info->mti_buf; - - buf->lb_buf = req_capsule_server_get(info->mti_pill, &RMF_ACL); - buf->lb_len = req_capsule_get_size(info->mti_pill, &RMF_ACL, - RCL_SERVER); - if (buf->lb_len > 0) { - rc = mo_xattr_get(env, next, buf, - XATTR_NAME_ACL_ACCESS); - if (rc < 0) { - if (rc == -ENODATA) { - repbody->mbo_aclsize = 0; - repbody->mbo_valid |= OBD_MD_FLACL; - rc = 0; - } else if (rc == -EOPNOTSUPP) { - rc = 0; - } else { - CERROR("got acl size: %d\n", rc); - } - } else { - repbody->mbo_aclsize = rc; - repbody->mbo_valid |= OBD_MD_FLACL; - rc = 0; - } - } - } + else if (exp_connect_flags(exp) & OBD_CONNECT_ACL) + rc = mdt_pack_acl2body(info, repbody, o, + exp->exp_target_data.ted_nodemap); #endif if (info->mti_mdt->mdt_lut.lut_mds_capa && @@ -1025,9 +1011,6 @@ int mdt_finish_open(struct mdt_thread_info *info, RETURN(rc); } -extern void mdt_req_from_lcd(struct ptlrpc_request *req, - struct lsd_client_data *lcd); - void mdt_reconstruct_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) { @@ -1141,7 +1124,7 @@ out: LASSERT(ergo(rc < 0, lustre_msg_get_transno(req->rq_repmsg) == 0)); } -int mdt_open_by_fid(struct mdt_thread_info *info, struct ldlm_reply *rep) +static int mdt_open_by_fid(struct mdt_thread_info *info, struct ldlm_reply *rep) { __u64 flags = info->mti_spec.sp_cr_flags; struct mdt_reint_record *rr = &info->mti_rr; @@ -1429,8 +1412,9 @@ static bool mdt_hsm_release_allow(const struct md_attr *ma) return true; } -int mdt_open_by_fid_lock(struct mdt_thread_info *info, struct ldlm_reply *rep, - struct mdt_lock_handle *lhc) +static int mdt_open_by_fid_lock(struct mdt_thread_info *info, + struct ldlm_reply *rep, + struct mdt_lock_handle *lhc) { const struct lu_env *env = info->mti_env; struct mdt_device *mdt = info->mti_mdt;