From: Sebastien Buisson Date: Fri, 16 Sep 2022 16:02:51 +0000 (+0200) Subject: LU-16165 sec: retry mechanism for identity cache X-Git-Tag: 2.15.3-RC1~8 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=a286c75bfb4a24ea67a540a3d20b0217c783f2c8;p=fs%2Flustre-release.git LU-16165 sec: retry mechanism for identity cache Implement a retry mechanism in the identity cache in case the identity up call times out. Lustre-change: https://review.whamcloud.com/48579 Lustre-commit: 61c3b3a9bb848e256845462ffd79b15565cd23ad Signed-off-by: Sebastien Buisson Change-Id: Ib70d3b851a6da3cf66dfed49b03be51da7886d01 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49746 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/upcall_cache.c b/lustre/obdclass/upcall_cache.c index 76f13e7..94a150b 100644 --- a/lustre/obdclass/upcall_cache.c +++ b/lustre/obdclass/upcall_cache.c @@ -146,6 +146,7 @@ struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache, __u64 key, void *args) { struct upcall_cache_entry *entry = NULL, *new = NULL, *next; + bool failedacquiring = false; struct list_head *head; wait_queue_entry_t wait; int rc, found; @@ -231,6 +232,12 @@ find_again: CERROR("acquire for key %llu: error %d\n", entry->ue_key, rc); put_entry(cache, entry); + if (!failedacquiring) { + spin_unlock(&cache->uc_lock); + failedacquiring = true; + new = NULL; + goto find_again; + } GOTO(out, entry = ERR_PTR(rc)); } } diff --git a/lustre/utils/l_getidentity.c b/lustre/utils/l_getidentity.c index cd4b041..52fd150 100644 --- a/lustre/utils/l_getidentity.c +++ b/lustre/utils/l_getidentity.c @@ -408,6 +408,7 @@ int main(int argc, char **argv) glob_t path; unsigned long uid; int fd, rc = -EINVAL, size, maxgroups; + bool alreadyfailed = false; progname = basename(argv[0]); if (argc != 3) { @@ -429,10 +430,15 @@ int main(int argc, char **argv) goto out; } +retry: size = offsetof(struct identity_downcall_data, idd_groups[maxgroups]); data = malloc(size); if (!data) { errlog("malloc identity downcall data(%d) failed!\n", size); + if (!alreadyfailed) { + alreadyfailed = true; + goto retry; + } rc = -ENOMEM; goto out; } @@ -475,6 +481,13 @@ downcall: close(fd); if (rc != size) { errlog("partial write ret %d: %s\n", rc, strerror(errno)); + if (!alreadyfailed) { + alreadyfailed = true; + cfs_free_param_data(&path); + if (data) + free(data); + goto retry; + } rc = -1; } else { rc = 0;