From patchwork Tue Dec 19 21:38:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10124497 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 DC2F360390 for ; Tue, 19 Dec 2017 21:38:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC11128A46 for ; Tue, 19 Dec 2017 21:38:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF6A628A5B; Tue, 19 Dec 2017 21:38:23 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2489328A46 for ; Tue, 19 Dec 2017 21:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753783AbdLSViV (ORCPT ); Tue, 19 Dec 2017 16:38:21 -0500 Received: from mail-eopbgr60058.outbound.protection.outlook.com ([40.107.6.58]:55952 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752004AbdLSViI (ORCPT ); Tue, 19 Dec 2017 16:38:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LMSYoGZ+Cbx5SGyYeJNDcfGQN4mMpkKrHTBzZEjncLQ=; b=NZ6Glu91j12ko0O7vDRIMWZJlXg2Orsa07iy/z4hY9SspWcbk1AjRsMuLlWVYsWcwWIm54wxP7Sezskd625fPGoTg4jQSl/J1rAFHn4YYknshwnKDFgme1UZgRXypsKtBe0VyKBx+dILtAYGz2XnqejR4PxC1zdpBFs7+fy4/Qw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jgg@mellanox.com; Received: from mlx.ziepe.ca (70.74.179.152) by VI1PR0501MB2864.eurprd05.prod.outlook.com (2603:10a6:800:9b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Tue, 19 Dec 2017 21:38:05 +0000 Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eRPaK-0007OT-6G; Tue, 19 Dec 2017 14:38:00 -0700 Date: Tue, 19 Dec 2017 14:38:00 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org, Bart Van Assche Subject: [PATCH v2 rdma-core] srp_daemon: Remove duplicate sync_res shutdown Message-ID: <20171219213800.GA28378@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [70.74.179.152] X-ClientProxiedBy: DB3PR0202CA0024.eurprd02.prod.outlook.com (2603:10a6:8:1::37) To VI1PR0501MB2864.eurprd05.prod.outlook.com (2603:10a6:800:9b::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fda1a875-10d0-4d83-f257-08d54728ca48 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:VI1PR0501MB2864; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2864; 3:yRwbrL7VX1WhcyBixqASxW22F84CO2OGFtPsUoMyJJz9UhwuEYgmpG6dB5QbqnaHgFhG9scnsdeaRGvHH+B0gW3Fks4Y7XQq4J5HfHEkw61XYi8qymUI6pgpc4fYFRw0iSK5nqRn4OG/FBythwxdAKndUsyy6cFu+AMcGiJjaqp6qgnNPEv4AY2gIXVSH7qKhC+XGaWLYXz8u48L7tY25so81v1F5YptQhI8Tf3mJVSaOJX1iHzlS6RsdAxkPyy6; 25:0Ov+CbgOg1B2pgqdomm0raR6kADWfJNLBNhvPkTicLnilJn9lCHVIkNKoCeY1rbi8JnvN71OdICwODm98qblZkca1FjbqEKbXfRsC2D2fGoUHMKnQm7hMir59naEidZxmBorN5unPT0GSL0WyJgC40mco14RokiybpM+9KbZZzRzxK7wl7ZYjQm+gn7e4Oo25dRTFbj6ooXM/Qr0GL2fqWU7A77arJzE1XR/6Eoc7OvngxxTeDm2fCvbpcQcIHJvavtJ1yfsCba5QJGvXZr4Jg+tNb494RAss7my/qyiStaufdJH5Yc42k2Rql0T1IeB5KcFfucZ8fF+2sdFNaorzQ==; 31:43LL0NI36kvPVr4qlT2O3HfIiP3gEIBISZDGcfCieVQxt1gov2L843CqYbeW3vJnz0VgzPkrfwKFjZNFwsK0ZJVydFhHMKEE5VLp9mhknhgYHvXUPIRLz73xz+2jGS3rx0eCiqNGVaSQL8te2/oVincfJlP43JmDttDYcnphvauREIopp9GP6suX8sqM7yAxwkBSXb26wdSSs8DIl5C+RkNh91izQGMTCzfspsBivDU= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2864: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2864; 20:qSd87OcQFpSW7hr/9MsBUunm+guxaYwX6bfX+qRcyDjvHkYI0rWEWTyggciiMn3IZAG14ymtTF35oYn0kAsE2OIOGI693Vl/ngTEgYe1k0YUtLh0koEbHQI7fJ7ACRJJXoNZ/cE7ANkdLC96hBGU8P1kFbhNs6/JKTU17aCWCHvTgS3jl7lsvN2wOdnD7I2dyrpEN6MIrtgJ+4MR3efhBemmbHn4R7yBOeLwZ3qoKEDEQecHETt5EHudt7xiXhsM1d6NjxTjKXLdLrJL/NFKvCJkOz08KaePhyHqNxa6xKGOk82C7N6+2khqLqAKWYq7cv40cdN93mLZSfywnxsMb8ZJrSSqYSu8fh49rdpvZ0eDfMgv12ikhAAl9FVpWpRzF2ujl1/g5z5UdiVSDGjPAFVz89Nt4tblvEiKMV7sWsG8JI6eFqi+cYX3nfBU1WZxs9WMUlG1KbP4F8EcKSKEJgCVs0ss4sxheWRozaehQYbiPEHzrtUPfmFDFmZkOtpL; 4:O2YbYd/E9FO9S/eltNawqY/NBM2CWRErtuFjs/jpx3gWe2io3FzAMQnX9I9FRbSxPtPrEaWXDpCDRl8RXPsVfcDSfdwAUWurUwInn9IUgihf7NsoFnexIr9qhM1LRiqttYhb3evum/r3LiKzIbQVwM/LAKGxDBLZ/Bl1QnF030RJ5vf02saL7sJWiF7Wrk1o8ly8kqXGu6Z/f9SXxQTjl4Zch4d5v+zcXxNgaLjvR76HdfMKAWEbQWVBaEXACSWgKQ8p7lAa0d0b4TVDNT0o6w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231023)(6055026)(6041248)(20161123555025)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(6072148)(201708071742011); SRVR:VI1PR0501MB2864; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0501MB2864; X-Forefront-PRVS: 052670E5A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(39860400002)(396003)(199004)(189003)(9686003)(86362001)(575784001)(69596002)(53936002)(3846002)(36756003)(6116002)(33656002)(50466002)(122856001)(33896004)(316002)(81156014)(8676002)(81166006)(52116002)(386003)(83796002)(58126008)(57986006)(6916009)(9786002)(105586002)(9746002)(16586007)(106356001)(59450400001)(305945005)(7736002)(478600001)(1076002)(68736007)(47776003)(97736004)(46656002)(23726003)(66066001)(5660300001)(83506002)(2906002)(8936002)(18370500001)(24400500001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2864; H:mlx.ziepe.ca; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2864; 23:SewT10VOiLYYScbNhNS/wWafjVWBvD8zgrZAgB0?= =?us-ascii?Q?2X+ddUyei2RkKZ8SHvnOvkg6tEU+xFd9tz0dKiCIOJJPkvIOJEBjgn9Iiwnh?= =?us-ascii?Q?Zk5Kzq2prmn6XZkYqhyODvjw/Fv1O/o7d9Gbz8yGB6pYIoDlgLdLX2xjuECm?= =?us-ascii?Q?ENuCk6eURvYerodc7P69zHFw0P6Imh2dNoCmf7qujoMlmZPUDjo2bMNEpDMD?= =?us-ascii?Q?I37a3IkqWM0j9QB7qiQai8r9kljS1wavkWUCCZrh27f2p8eXyLD7oKhnztTY?= =?us-ascii?Q?NAXHUJJXzm6WIdPoSWzlTJU8nhunayuwN8XVU1PmPOmiQjyJkmmCUuinmmG7?= =?us-ascii?Q?Ssmk5bJs7wHoZnqlItArfZxgLijbqYTDN0i8Qc2/5jiIiyye/It2uJAWyd+4?= =?us-ascii?Q?nq52SIbxba9vgZesLahES1W/ODz4/JLcjcBdnXleXswstk093Fp6VmKT2MZY?= =?us-ascii?Q?VfHkrpc9PX9hk9U56VIkYgjc+WE4OHJqxgwXKLU3IrFOt++8ByoSfrQQheoS?= =?us-ascii?Q?C+9m17Jcw4HBgqektdRJ5E0mC4pL/u2wXDBetERBI5enLLBbrdsxB3MM2II8?= =?us-ascii?Q?v+db4q3DMuYvCPb/0p7MCAPAXFsaJ0jdQR0MViTlG3+e+QSHLGyW6IeKrg+0?= =?us-ascii?Q?DCuH7QGpf6ON3mzWmM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s6xVDv7pPw9u7vQET/bTK5bFGEDbu2iRJqnlWCCWQ1FOsLUHQH9rpkCw=; 5:+Xu47V+uQqswjiBPlQT6JVg00T3FvVJNsU+kk7YWjRjgzye9qQ5JzhtYAfZkYSZpatc18v5IAVF+IbdK55vGXwGBbU2BuBDUU7m5rKojHqMyQ4zgfofvlcwERIRTMDX7NpBmbcNmcTFL7fZ7mnsa0AIT9D4+rD50JqbUbFPUn/I=; 24:zmOv7Ry00bU1mFkXPbGG99hLHEdOEbRPWIpN1ZL40hcAmyzizlf8W4e+V4KMC9txiQcsSzL7XAXB9kUjFHhjiYygg0WVqPV8qyRvjTKqyns=; 7:KILpw/JbtTkUH934lOd16XSJbN2y6bKIRdgc3Z3adh3Seftj5XpDiT8rN4e1mmJxQMeIB5dOkLpG/iXi6b2SkhPnovtFEx1EsRK2jCB5KUV4pWGIDjue5k4rh64hrBwfGx5+SF4vLLsCmb+zHfzlDETRMuaQYev2/XJ0mPvvYPBwLwVHkhov/b7d3OL74Eh7p86zFg+23EWg95LH/V7iBVhXr13UMSjnW9yO+6/LAccojJeTaxHc6IvGhQxqjY5p SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 21:38:05.8960 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fda1a875-10d0-4d83-f257-08d54728ca48 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2864 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The very first thing free_res does is the same lock/signal/unlock sequence, so there is no reason to open code it before calling free_res. res->sync_res always exists at this point so remove the assert too. Signed-off-by: Jason Gunthorpe --- srp_daemon/srp_daemon.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) v2: Remove the assert too diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index cec36db2e0f12e..696c58bfd0b1ec 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -1899,7 +1899,7 @@ static void free_res(struct resources *res) pthread_join(res->trap_thread, &status); } if (res->sync_res) - sync_resources_cleanup(res->sync_res); + f sync_resources_cleanup(res->sync_res); if (res->ud_res) ud_resources_destroy(res->ud_res); if (res->umad_res) @@ -2073,12 +2073,6 @@ static int ibsrpdm(int argc, char *argv[]) if (ret) pr_err("Querying SRP targets failed\n"); - assert(res->sync_res); - pthread_mutex_lock(&res->sync_res->retry_mutex); - res->sync_res->stop_threads = 1; - pthread_cond_signal(&res->sync_res->retry_cond); - pthread_mutex_unlock(&res->sync_res->retry_mutex); - free_res(res); umad_done: umad_done();