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=22781 fix the waiting time/race of identity upcall.
[fs/lustre-release.git]
/
lustre
/
mdt
/
mdt_identity.c
diff --git
a/lustre/mdt/mdt_identity.c
b/lustre/mdt/mdt_identity.c
index
f7b1658
..
434ddbd
100644
(file)
--- a/
lustre/mdt/mdt_identity.c
+++ b/
lustre/mdt/mdt_identity.c
@@
-26,7
+26,7
@@
* GPL HEADER END
*/
/*
* GPL HEADER END
*/
/*
- * Copyright
2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright
(c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
* Use is subject to license terms.
*/
/*
@@
-87,7
+87,7
@@
static void mdt_identity_entry_free(struct upcall_cache *cache,
struct md_identity *identity = &entry->u.identity;
if (identity->mi_ginfo) {
struct md_identity *identity = &entry->u.identity;
if (identity->mi_ginfo) {
- put_group_info(identity->mi_ginfo);
+
cfs_
put_group_info(identity->mi_ginfo);
identity->mi_ginfo = NULL;
}
identity->mi_ginfo = NULL;
}
@@
-114,6
+114,7
@@
static int mdt_identity_do_upcall(struct upcall_cache *cache,
[1] = "PATH=/sbin:/usr/sbin",
[2] = NULL
};
[1] = "PATH=/sbin:/usr/sbin",
[2] = NULL
};
+ struct timeval start, end;
int size, rc;
ENTRY;
int size, rc;
ENTRY;
@@
-125,9
+126,9
@@
static int mdt_identity_do_upcall(struct upcall_cache *cache,
if (unlikely(!upcall))
RETURN(-ENOMEM);
if (unlikely(!upcall))
RETURN(-ENOMEM);
- read_lock(&cache->uc_upcall_rwlock);
+
cfs_
read_lock(&cache->uc_upcall_rwlock);
memcpy(upcall, cache->uc_upcall, size - 1);
memcpy(upcall, cache->uc_upcall, size - 1);
- read_unlock(&cache->uc_upcall_rwlock);
+
cfs_
read_unlock(&cache->uc_upcall_rwlock);
upcall[size - 1] = 0;
if (unlikely(!strcmp(upcall, "NONE"))) {
CERROR("no upcall set\n");
upcall[size - 1] = 0;
if (unlikely(!strcmp(upcall, "NONE"))) {
CERROR("no upcall set\n");
@@
-140,15
+141,19
@@
static int mdt_identity_do_upcall(struct upcall_cache *cache,
CDEBUG(D_INFO, "The upcall is: '%s'\n", cache->uc_upcall);
CDEBUG(D_INFO, "The upcall is: '%s'\n", cache->uc_upcall);
+ cfs_gettimeofday(&start);
rc = USERMODEHELPER(argv[0], argv, envp);
rc = USERMODEHELPER(argv[0], argv, envp);
+ cfs_gettimeofday(&end);
if (rc < 0) {
CERROR("%s: error invoking upcall %s %s %s: rc %d; "
if (rc < 0) {
CERROR("%s: error invoking upcall %s %s %s: rc %d; "
- "check /proc/fs/lustre/mdt/%s/identity_upcall\n",
+ "check /proc/fs/lustre/mdt/%s/identity_upcall, "
+ "time %ldus\n",
cache->uc_name, argv[0], argv[1], argv[2], rc,
cache->uc_name, argv[0], argv[1], argv[2], rc,
- cache->uc_name);
+ cache->uc_name
, cfs_timeval_sub(&end, &start, NULL)
);
} else {
} else {
- CDEBUG(D_HA, "%s: invoked upcall %s %s %s\n", cache->uc_name,
- argv[0], argv[1], argv[2]);
+ CDEBUG(D_HA, "%s: invoked upcall %s %s %s, time %ldus\n",
+ cache->uc_name, argv[0], argv[1], argv[2],
+ cfs_timeval_sub(&end, &start, NULL));
rc = 0;
}
EXIT;
rc = 0;
}
EXIT;
@@
-163,7
+168,7
@@
static int mdt_identity_parse_downcall(struct upcall_cache *cache,
{
struct md_identity *identity = &entry->u.identity;
struct identity_downcall_data *data = args;
{
struct md_identity *identity = &entry->u.identity;
struct identity_downcall_data *data = args;
-
struct group_info
*ginfo;
+
cfs_group_info_t
*ginfo;
struct md_perm *perms = NULL;
int size, i;
ENTRY;
struct md_perm *perms = NULL;
int size, i;
ENTRY;
@@
-172,7
+177,7
@@
static int mdt_identity_parse_downcall(struct upcall_cache *cache,
if (data->idd_ngroups > NGROUPS_MAX)
RETURN(-E2BIG);
if (data->idd_ngroups > NGROUPS_MAX)
RETURN(-E2BIG);
- ginfo = groups_alloc(data->idd_ngroups);
+ ginfo =
cfs_
groups_alloc(data->idd_ngroups);
if (!ginfo) {
CERROR("failed to alloc %d groups\n", data->idd_ngroups);
RETURN(-ENOMEM);
if (!ginfo) {
CERROR("failed to alloc %d groups\n", data->idd_ngroups);
RETURN(-ENOMEM);
@@
-187,7
+192,7
@@
static int mdt_identity_parse_downcall(struct upcall_cache *cache,
if (!perms) {
CERROR("failed to alloc %d permissions\n",
data->idd_nperms);
if (!perms) {
CERROR("failed to alloc %d permissions\n",
data->idd_nperms);
- put_group_info(ginfo);
+
cfs_
put_group_info(ginfo);
RETURN(-ENOMEM);
}
RETURN(-ENOMEM);
}