From patchwork Mon Feb 24 19:05:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jonathan.dascenzo@netapp.com X-Patchwork-Id: 3711511 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CE7559F35F for ; Mon, 24 Feb 2014 19:05:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07C6C20149 for ; Mon, 24 Feb 2014 19:05:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 622DD2012E for ; Mon, 24 Feb 2014 19:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752291AbaBXTFm (ORCPT ); Mon, 24 Feb 2014 14:05:42 -0500 Received: from mx11.netapp.com ([216.240.18.76]:5939 "EHLO mx11.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbaBXTFl (ORCPT ); Mon, 24 Feb 2014 14:05:41 -0500 X-IronPort-AV: E=Sophos;i="4.97,536,1389772800"; d="scan'208";a="104425442" Received: from vmwexceht02-prd.hq.netapp.com ([10.106.76.240]) by mx11-out.netapp.com with ESMTP; 24 Feb 2014 11:05:38 -0800 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCEHT02-PRD.hq.netapp.com (10.106.76.240) with Microsoft SMTP Server id 14.3.123.3; Mon, 24 Feb 2014 11:05:38 -0800 Received: from ssqa-tc-03.gdl.englab.netapp.com (ssqa-tc-03.gdl.englab.netapp.com [10.229.152.172]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id s1OJ5cNS003018; Mon, 24 Feb 2014 11:05:38 -0800 (PST) From: To: CC: , Jonathan Dascenzo Subject: [PATCH 1/1] fix tlock.c to use sigaction() over deprecated signal(). Fixes sync issues when client is loaded. (Particularly test12) Date: Mon, 24 Feb 2014 14:05:34 -0500 Message-ID: <1393268734-23325-1-git-send-email-jonathan.dascenzo@netapp.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jonathan Dascenzo --- lock/tlock.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/lock/tlock.c b/lock/tlock.c index 8a7d0cc..39a6ad9 100644 --- a/lock/tlock.c +++ b/lock/tlock.c @@ -272,20 +272,24 @@ testexit(nok) int nok; { + struct sigaction act; close_testfile(DO_UNLINK); if (nok) { testreport(1); } if (who == PARENT) { - signal(SIGCLD, SIG_DFL); + act.sa_handler = SIG_DFL; + sigaction(SIGCLD, &act, NULL); if (nok) { - signal(SIGINT, SIG_IGN); + act.sa_handler = SIG_IGN; + sigaction(SIGINT, &act, NULL); kill(childpid, SIGINT); } wait((int *)0); } else { if (nok) { - signal(SIGINT, SIG_IGN); + act.sa_handler = SIG_IGN; + sigaction(SIGINT, &act, NULL); kill(parentpid, SIGINT); } } @@ -1450,7 +1454,9 @@ test12() close_testfile(DO_UNLINK); } else { /* subchild */ - signal(SIGINT, SIG_DFL); + struct sigaction act; + act.sa_handler = SIG_DFL; + sigaction(SIGINT, &act, NULL); test(12, 0, F_TLOCK, (off_t)0, (off_t)0, PASS, FATAL); for (;;) sleep(1); @@ -1667,13 +1673,19 @@ main(argc, argv) /* * Fork child... */ + struct sigaction act; + act.sa_handler = SIG_DFL; if ((childpid = fork()) == 0) { who = CHILD; - signal(SIGINT, parentsig); + sigaction(SIGINT, &act, NULL); + act.sa_handler = parentsig; + sigaction(SIGINT, &act, NULL); } else { who = PARENT; - signal(SIGINT, childsig); - signal(SIGCLD, childdied); + act.sa_handler = childsig; + sigaction(SIGINT, &act, NULL); + act.sa_handler = childdied; + sigaction(SIGCLD, &act, NULL); } /* @@ -1692,7 +1704,9 @@ main(argc, argv) if (who == CHILD) { childwait(); } else { - signal(SIGCLD, SIG_DFL); + struct sigaction; + act.sa_handler = SIG_DFL; + sigaction(SIGCLD, &act, NULL); childfree(0); } testexit(0);