From b1b3788f6b127e25ec2275429421e572be0cd571 Mon Sep 17 00:00:00 2001 From: fanyong Date: Sat, 21 Oct 2006 14:50:04 +0000 Subject: [PATCH] Add timestamp for remote client permission, reduce unnecessary checking. --- lustre/llite/llite_internal.h | 1 + lustre/llite/llite_lib.c | 1 + lustre/llite/remote_perm.c | 13 +++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 19f10a1..4480edb 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -113,6 +113,7 @@ struct ll_inode_info { /* remote permission hash */ struct hlist_head *lli_remote_perms; + unsigned long lli_rmtperm_utime; struct semaphore lli_rmtperm_sem; struct list_head lli_dead_list; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 04358e1..3a8e89c0 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -789,6 +789,7 @@ void ll_lli_init(struct ll_inode_info *lli) lli->lli_open_fd_exec_count = 0; INIT_LIST_HEAD(&lli->lli_dead_list); lli->lli_remote_perms = NULL; + lli->lli_rmtperm_utime = 0; sema_init(&lli->lli_rmtperm_sem, 1); INIT_LIST_HEAD(&lli->lli_oss_capas); } diff --git a/lustre/llite/remote_perm.c b/lustre/llite/remote_perm.c index d472951..9b70f4f 100644 --- a/lustre/llite/remote_perm.c +++ b/lustre/llite/remote_perm.c @@ -215,6 +215,7 @@ again: lrp->lrp_access_perm = perm->rp_access_perm; if (lrp != tmp) hlist_add_head(&lrp->lrp_list, head); + lli->lli_rmtperm_utime = jiffies; spin_unlock(&lli->lli_lock); CDEBUG(D_SEC, "new remote perm@%p: %u/%u/%u/%u - %#x\n", @@ -231,10 +232,12 @@ int lustre_check_remote_perm(struct inode *inode, int mask) struct ptlrpc_request *req = NULL; struct mdt_remote_perm *perm; struct obd_capa *oc; + unsigned long utime; 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); @@ -243,10 +246,12 @@ check: down(&lli->lli_rmtperm_sem); /* check again */ - rc = do_check_remote_perm(lli, mask); - if (!rc || ((rc != -ENOENT) && i)) { - up(&lli->lli_rmtperm_sem); - RETURN(rc); + if (utime != lli->lli_rmtperm_utime) { + rc = do_check_remote_perm(lli, mask); + if (!rc || ((rc != -ENOENT) && i)) { + up(&lli->lli_rmtperm_sem); + RETURN(rc); + } } if (i++ > 5) { -- 1.8.3.1