Whamcloud - gitweb
LU-16165 sec: retry mechanism for identity cache 79/48579/4
authorSebastien Buisson <sbuisson@ddn.com>
Fri, 16 Sep 2022 16:02:51 +0000 (18:02 +0200)
committerOleg Drokin <green@whamcloud.com>
Fri, 13 Jan 2023 07:21:17 +0000 (07:21 +0000)
Implement a retry mechanism in the identity cache in case the
identity up call times out.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Ib70d3b851a6da3cf66dfed49b03be51da7886d01
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48579
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/upcall_cache.c
lustre/utils/l_getidentity.c

index 76f13e7..94a150b 100644 (file)
@@ -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));
                }
        }
index cd4b041..52fd150 100644 (file)
@@ -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;