From patchwork Wed Oct 12 07:59:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 9372205 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF4C5608A0 for ; Wed, 12 Oct 2016 08:01:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C061229378 for ; Wed, 12 Oct 2016 08:01:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4BD129D01; Wed, 12 Oct 2016 08:01:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F7C129D00 for ; Wed, 12 Oct 2016 08:01:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9C7xJL4013636; Wed, 12 Oct 2016 03:59:19 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9C7xIqf004932 for ; Wed, 12 Oct 2016 03:59:18 -0400 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9C7xIc8002496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 12 Oct 2016 03:59:18 -0400 Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8840866846 for ; Wed, 12 Oct 2016 07:59:16 +0000 (UTC) Received: by mail-wm0-f41.google.com with SMTP id b201so15695496wmb.0 for ; Wed, 12 Oct 2016 00:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=ntHgX9r72PCKSe0ZFBQ7TU0riLHTcmUH7NQ/KwSN/pg=; b=VOlrWn6XliSUb1g7818kDzp+JoH0n8fMtZ5Zv48noCT9s/kP2kJjlMovXR3YZ9e2o7 pVQ/wzXXlH1N0cEzF2+GdiMi+PZDc1WRa+eavux8zO4/4rOXJlkSt8unCoHcFGxsbpKM VWKlCQyoUTWg5Bqi2YKWUar5hBDfsk1sM4AjpBbeN8/h8pZ4Im/ATMTYr+H2fMq31dTA 8WZWc0HqICNL7bKJ68s7e8LwIN5HJ4DngWrhhYE8nLXIi8X9dR5JnMYpkhnToya9r0QY HqpQTR7W1o990Bn2cUqGXmORh60HtUk1pddY/CTXdMAheP0A5mU/vVXvuNyM+10KnVxn pBgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=ntHgX9r72PCKSe0ZFBQ7TU0riLHTcmUH7NQ/KwSN/pg=; b=GSZp2g3hADfqBB8wW1wkjK3LTmg+83LzxNF3NxNRmzzQCBTYOJrBmhhmOi0eu2WQos W+BQu8Sa7nGDR+Wzs8UkOpF0a33iBfNH+pJ00QOoQYf+YSo0T3TnBFMd50G6T0p2LVHP SbSDYKxMoG3IrGl+Dh+5xCrGHjvReoosPpcvw+o5YtoUNL0b6tB1Qp8k5rS2qXTzeFQ3 9gXwBwM8wBp/l+NJEHzChXP+IA4TtMIyjMlzNCLqlKdcDOQ/hlvKnt33Q8s0vFO8IIQM oXQ2tIFw3RC7rJ3Evw46Z8+ForUWuYlu+U2kasB0B06nBgq7AfXB+k7A2ycW8c+m0j8t 6/Lg== X-Gm-Message-State: AA6/9Rk+pz21H9gDJQFT0EhPbp/0wJxfNmHsJlLDY7O3mUZ6FDqffW4kjX8REddVUuc16pPN X-Received: by 10.28.199.73 with SMTP id x70mr1391213wmf.45.1476259155080; Wed, 12 Oct 2016 00:59:15 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by smtp.googlemail.com with ESMTPSA id g139sm1500543wmd.16.2016.10.12.00.59.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Oct 2016 00:59:14 -0700 (PDT) To: christophe.varoqui@opensvc.com, dm-devel@redhat.com From: Michael Wang Message-ID: <018d2a56-5c23-4a61-5b27-8fe80a6283a8@profitbricks.com> Date: Wed, 12 Oct 2016 09:59:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 12 Oct 2016 07:59:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 12 Oct 2016 07:59:16 +0000 (UTC) for IP:'74.125.82.41' DOMAIN:'mail-wm0-f41.google.com' HELO:'mail-wm0-f41.google.com' FROM:'yun.wang@profitbricks.com' RCPT:'' X-RedHat-Spam-Score: 0.869 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 74.125.82.41 mail-wm0-f41.google.com 74.125.82.41 mail-wm0-f41.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-loop: dm-devel@redhat.com Subject: [dm-devel] [RFC] unreleased lock after handler failure X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP Hi, folks While we are testing with the latest multipathd, we encounter issue that once 'del map' failed, all the following operation will show 'error -1 receiving packet' whatever how long the timeout has been set (we have applied the latest fix which make sure the poll will last for 10 seconds). After some debugging we found that inside parse_cmd(), the pthread_cleanup_pop() rely on '!r' as indicator for locked or not, while this will be overwritten if the handler return failed (1 in our case), and then the unlock will be missed. After applied below fix the problem got solved, although the del map failed, the other operation can still works. Could you please help to review whether this is really the problem to be fixed like that? Regards, Michael Wang --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/multipathd/cli.c b/multipathd/cli.c index e8a9384..50161be 100644 --- a/multipathd/cli.c +++ b/multipathd/cli.c @@ -481,6 +481,7 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout ) tmo.tv_sec = 0; } if (h->locked) { + int locked = 0; struct vectors * vecs = (struct vectors *)data; pthread_cleanup_push(cleanup_lock, &vecs->lock); @@ -491,10 +492,11 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout ) r = 0; } if (r == 0) { + locked = 1; pthread_testcancel(); r = h->fn(cmdvec, reply, len, data); } - pthread_cleanup_pop(!r); + pthread_cleanup_pop(locked); } else r = h->fn(cmdvec, reply, len, data); free_keys(cmdvec);