]> sourceware.org Git - lvm2.git/commitdiff
cleanup: clvmd zombie removal loop
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 Mar 2014 11:56:35 +0000 (12:56 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 Mar 2014 21:29:27 +0000 (22:29 +0100)
Simplier code to start scan from the next node,
and remove matching pipe client.

daemons/clvmd/clvmd.c

index 3d7d072f7ba33999e524e0b73fb47ea6e817fbac..9e58fd091d209a2b3aba631c1fe607819cdc771c 100644 (file)
@@ -1179,29 +1179,20 @@ static int cleanup_zombie(struct local_client *thisfd)
 
                /* Remove the pipe client */
                if (thisfd->bits.localsock.pipe_client) {
-                       struct local_client *newfd;
-                       struct local_client *lastfd = NULL;
-                       struct local_client *free_fd = NULL;
+                       struct local_client *delfd;
+                       struct local_client *lastfd;
 
                        (void) close(thisfd->bits.localsock.pipe_client->fd);   /* Close pipe */
                        (void) close(thisfd->bits.localsock.pipe);
 
                        /* Remove pipe client */
-                       for (newfd = &local_client_head; newfd != NULL;
-                            newfd = newfd->next) {
-                               if (thisfd->bits.localsock.
-                                   pipe_client == newfd) {
-                                       thisfd->bits.localsock.
-                                           pipe_client = NULL;
-
-                                       lastfd->next = newfd->next;
-                                       free_fd = newfd;
-                                       newfd->next = lastfd;
-                                       dm_free(free_fd);
+                       for (lastfd = &local_client_head; (delfd = lastfd->next); lastfd = delfd)
+                               if (thisfd->bits.localsock.pipe_client == delfd) {
+                                       thisfd->bits.localsock.pipe_client = NULL;
+                                       lastfd->next = delfd->next;
+                                       dm_free(delfd);
                                        break;
                                }
-                               lastfd = newfd;
-                       }
                }
        }
 
This page took 0.031414 seconds and 5 git commands to generate.