Whamcloud - gitweb
LU-5564 mdt: skip permission check for close 34/15534/8
authorHongchao Zhang <hongchao.zhang@intel.com>
Mon, 30 May 2016 16:10:37 +0000 (00:10 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 20 Jun 2016 00:59:00 +0000 (00:59 +0000)
When closing a file normally, skip the permission check
for open handle gives us permission.

Change-Id: I74271eb83cdd807940cb6ba37ede05fa9f9751ce
Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/15534
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_lib.c

index a3b5693..eb08efc 100644 (file)
@@ -547,11 +547,17 @@ int mdt_init_ucred_reint(struct mdt_thread_info *info)
 {
        struct ptlrpc_request *req = mdt_info_req(info);
        struct lu_ucred       *uc  = mdt_ucred(info);
+       struct md_attr        *ma  = &info->mti_attr;
 
        LASSERT(uc != NULL);
        if ((uc->uc_valid == UCRED_OLD) || (uc->uc_valid == UCRED_NEW))
                return 0;
 
+       /* LU-5564: for normal close request, skip permission check */
+       if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE &&
+           !(ma->ma_attr_flags & (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP)))
+               uc->uc_cap |= CFS_CAP_FS_MASK;
+
        mdt_exit_ucred(info);
 
        if (!req->rq_auth_gss || req->rq_auth_usr_mdt || !req->rq_user_desc)