All of lore.kernel.org
 help / color / mirror / Atom feed
From: mwilck@suse.com
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [dm-devel] [PATCH 13/16] multipath: find_multipaths_check_timeout(): no need for pthread cleanup
Date: Thu,  1 Sep 2022 18:09:49 +0200	[thread overview]
Message-ID: <20220901160952.2167-14-mwilck@suse.com> (raw)
In-Reply-To: <20220901160952.2167-1-mwilck@suse.com>

From: Martin Wilck <mwilck@suse.com>

multipath is not a multithreaded program, no pthread-cancel complexity
is necesssary here.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipath/main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/multipath/main.c b/multipath/main.c
index fbff6b7..7b69a3c 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -321,7 +321,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo,
 	char path[PATH_MAX];
 	struct timespec now, ftimes[2], tdiff;
 	struct stat st;
-	int fd = -1;
+	int fd;
 	int r, retries = 0;
 
 	clock_gettime(CLOCK_REALTIME, &now);
@@ -339,9 +339,8 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo,
 retry:
 	fd = open(path, O_RDONLY);
 	if (fd != -1) {
-		pthread_cleanup_push(cleanup_fd_ptr, &fd);
 		r = fstat(fd, &st);
-		pthread_cleanup_pop(1);
+		close(fd);
 
 	} else if (tmo > 0) {
 		if (errno == ENOENT)
@@ -355,7 +354,6 @@ retry:
 			return FIND_MULTIPATHS_ERROR;
 		};
 
-		pthread_cleanup_push(cleanup_fd_ptr, &fd);
 		/*
 		 * We just created the file. Set st_mtim to our desired
 		 * expiry time.
@@ -369,7 +367,7 @@ retry:
 				path, strerror(errno));
 		}
 		r = fstat(fd, &st);
-		pthread_cleanup_pop(1);
+		close(fd);
 	} else
 		return FIND_MULTIPATHS_NEVER;
 
-- 
2.37.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2022-09-01 16:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 16:09 [dm-devel] [PATCH 00/16] multipath-tools: minor fixes and build improvements mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 01/16] multipath-tools: Makefile: remove useless .PHONY targets mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 02/16] multipath-tools: Makefile: fix install->all dependency mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 03/16] multipath-tools: Makefile: remove dependency test -> test-progs mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 04/16] multipath-tools: Makefile: run abidiff with --redundant flag mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 05/16] libdmmp: Makefile: create man3dir mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 06/16] tests/Makefile: use $(multipathdir) mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 07/16] tests/Makefile: add library dependencies mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 08/16] tests/Makefile: use symbolic links under tests/lib mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 09/16] tests/Makefile: redirect program output into output file mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 10/16] GitHub workflows: package shared objects in artifact mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 11/16] libmultipath: replace close_fd() with cleanup_fd_ptr() mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 12/16] libmultipath: cleanup_free_ptr(): avoid double free mwilck
2022-09-01 16:09 ` mwilck [this message]
2022-09-01 16:09 ` [dm-devel] [PATCH 14/16] multipathd: fix segfault in cli_list_map_fmt() mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 15/16] multipathd: fix broken pthread cleanup in fpin_fabric_notification_receiver() mwilck
2022-09-01 16:09 ` [dm-devel] [PATCH 16/16] multipathd: Fix command completion in interactive mode mwilck
2022-09-02 23:56 ` [dm-devel] [PATCH 00/16] multipath-tools: minor fixes and build improvements Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220901160952.2167-14-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.