Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
b=15625
[fs/lustre-release.git]
/
lustre
/
llite
/
remote_perm.c
diff --git
a/lustre/llite/remote_perm.c
b/lustre/llite/remote_perm.c
index
ac0aec0
..
7c06949
100644
(file)
--- 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)
@@
-100,7
+100,7
@@
static inline int remote_perm_hashfunc(uid_t uid)
}
/* NB: setxid permission is not checked here, instead it's done on
- * MDT when client get remote permission.
(lookup/mdc_get_remote_perm).
*/
+ * MDT when client get remote permission. */
static int do_check_remote_perm(struct ll_inode_info *lli, int mask)
{
struct hlist_head *head;
@@
-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, &req);
- capa_put(oc);
- if (rc) {
+ rc = ll_update_remote_perm(inode, perm);
up(&lli->lli_rmtperm_sem);
- RETURN(rc);
- }
-
- perm = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF + 1, sizeof(*perm));
- LASSERT(perm);
- LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF + 1));
-
- 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,