X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fremote_perm.c;h=7c0694989f9337e7c0c8280624f70a1f33bdc6dc;hb=805392ae4c4a4295d0f027234c83a670dfdc2268;hp=20cfa35b802b4625297525093815bd97ec5ff891;hpb=fd908da92ccd9aab4ffc3d2463301831260c0474;p=fs%2Flustre-release.git diff --git a/lustre/llite/remote_perm.c b/lustre/llite/remote_perm.c index 20cfa35..7c06949 100644 --- a/lustre/llite/remote_perm.c +++ b/lustre/llite/remote_perm.c @@ -45,7 +45,7 @@ static inline struct ll_remote_perm *alloc_ll_remote_perm(void) { struct ll_remote_perm *lrp; - OBD_SLAB_ALLOC(lrp, ll_remote_perm_cachep, SLAB_KERNEL, sizeof(*lrp)); + OBD_SLAB_ALLOC(lrp, ll_remote_perm_cachep, GFP_KERNEL, sizeof(*lrp)); if (lrp) INIT_HLIST_NODE(&lrp->lrp_list); return lrp; @@ -66,7 +66,7 @@ struct hlist_head *alloc_rmtperm_hash(void) struct hlist_head *hash; int i; - OBD_SLAB_ALLOC(hash, ll_rmtperm_hash_cachep, SLAB_KERNEL, + OBD_SLAB_ALLOC(hash, ll_rmtperm_hash_cachep, GFP_KERNEL, REMOTE_PERM_HASHSIZE * sizeof(*hash)); if (!hash) @@ -239,50 +239,56 @@ int lustre_check_remote_perm(struct inode *inode, int mask) int i = 0, rc; ENTRY; -check: - utime = lli->lli_rmtperm_utime; - rc = do_check_remote_perm(lli, mask); - if (!rc || ((rc != -ENOENT) && i)) - RETURN(rc); + do { + utime = lli->lli_rmtperm_utime; + rc = do_check_remote_perm(lli, mask); + if (!rc || (rc != -ENOENT && i)) + break; + + might_sleep(); + + down(&lli->lli_rmtperm_sem); + /* check again */ + if (utime != lli->lli_rmtperm_utime) { + rc = do_check_remote_perm(lli, mask); + if (!rc || (rc != -ENOENT && i)) { + up(&lli->lli_rmtperm_sem); + break; + } + } - might_sleep(); + if (i++ > 5) { + CERROR("check remote perm falls in dead loop!\n"); + LBUG(); + } - down(&lli->lli_rmtperm_sem); - /* check again */ - if (utime != lli->lli_rmtperm_utime) { - rc = do_check_remote_perm(lli, mask); - if (!rc || ((rc != -ENOENT) && i)) { + oc = ll_mdscapa_get(inode); + rc = md_get_remote_perm(sbi->ll_md_exp, ll_inode2fid(inode), oc, + ll_i2suppgid(inode), &req); + capa_put(oc); + if (rc) { up(&lli->lli_rmtperm_sem); - RETURN(rc); + break; } - } - if (i++ > 5) { - CERROR("check remote perm falls in dead loop!\n"); - LBUG(); - } + perm = req_capsule_server_swab_get(&req->rq_pill, &RMF_ACL, + lustre_swab_mdt_remote_perm); + if (unlikely(perm == NULL)) { + up(&lli->lli_rmtperm_sem); + rc = -EPROTO; + break; + } - oc = ll_mdscapa_get(inode); - rc = md_get_remote_perm(sbi->ll_md_exp, ll_inode2fid(inode), oc, - ll_i2suppgid(inode), &req); - capa_put(oc); - if (rc) { + rc = ll_update_remote_perm(inode, perm); up(&lli->lli_rmtperm_sem); - RETURN(rc); - } - - perm = req_capsule_server_get(&req->rq_pill, &RMF_ACL); - LASSERT(perm); - - rc = ll_update_remote_perm(inode, perm); - up(&lli->lli_rmtperm_sem); + if (rc == -ENOMEM) + break; + ptlrpc_req_finished(req); + req = NULL; + } while (1); ptlrpc_req_finished(req); - - if (rc == -ENOMEM) - RETURN(rc); - - goto check; + RETURN(rc); } #if 0 /* NB: remote perms can't be freed in ll_mdc_blocking_ast of UPDATE lock,