From patchwork Wed Dec 7 04:04:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 9463873 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 CB12860459 for ; Wed, 7 Dec 2016 04:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B95B5284DC for ; Wed, 7 Dec 2016 04:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD26A284E0; Wed, 7 Dec 2016 04:05:10 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 371C4284CD for ; Wed, 7 Dec 2016 04:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932166AbcLGEFH (ORCPT ); Tue, 6 Dec 2016 23:05:07 -0500 Received: from mga07.intel.com ([134.134.136.100]:64797 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753133AbcLGEFF (ORCPT ); Tue, 6 Dec 2016 23:05:05 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 06 Dec 2016 20:04:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,310,1477983600"; d="scan'208";a="1078495615" Received: from rzwisler-desk1.amr.corp.intel.com (HELO tarkir.intel.com) ([10.255.7.218]) by fmsmga001.fm.intel.com with ESMTP; 06 Dec 2016 20:04:57 -0800 From: Ross Zwisler To: fstests@vger.kernel.org Cc: Ross Zwisler , Dave Chinner , Lukas Czerner , Allison Henderson , Christoph Hellwig , Nathan Scott Subject: [PATCH] xfstests: fix build warnings and notify_others() bug Date: Tue, 6 Dec 2016 21:04:01 -0700 Message-Id: <1481083441-4809-1-git-send-email-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch addresses the following build warnings: fsx.c: In function 'do_punch_hole': fsx.c:940:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (!quiet && testcalls > simulatedopcount) ^~ fsx.c:942:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); ^~~~ fsx.c:947:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (!quiet && testcalls > simulatedopcount) ^~ fsx.c:949:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); ^~~~ fsx.c: In function 'do_zero_range': fsx.c:995:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (!quiet && testcalls > simulatedopcount) ^~ fsx.c:997:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' log4(OP_ZERO_RANGE, offset, length, FL_SKIPPED | ^~~~ [CC] growfiles growfiles.c: In function 'notify_others': growfiles.c:1458:6: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if ( Forker_pids[ind] != Pid ) ^~ growfiles.c:1462:10: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' kill(Forker_pids[ind], SIGUSR2); ^~~~ The warnings in fsx.c were just spacing issues of the form: if (length == 0) { if (!quiet && testcalls > simulatedopcount) prt("skipping zero length punch hole\n"); log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); return; } Where the log4() call just needs to be unindented. log4() calls elsewhere in that same file are not protected with any sort of 'quiet' check, and commonly follow prt() calls which are. See doread(), domapread(), etc. The warning from growfiles.c was actually a bug. notify_others() is looping through the Forker_pids[] array and sending SIGUSR2 to all other processes. However, with the current logic it only *logs* the kill for other processes, and kills all other processes plus the Forker_pids[] entry that matches 'Pid'. Signed-off-by: Ross Zwisler Cc: Dave Chinner Cc: Lukas Czerner Cc: Allison Henderson Cc: Christoph Hellwig Cc: Nathan Scott --- ltp/fsx.c | 8 ++++---- ltp/growfiles.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 74a3b74..3713bbe 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -939,14 +939,14 @@ do_punch_hole(unsigned offset, unsigned length) if (length == 0) { if (!quiet && testcalls > simulatedopcount) prt("skipping zero length punch hole\n"); - log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); + log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); return; } if (file_size <= (loff_t)offset) { if (!quiet && testcalls > simulatedopcount) prt("skipping hole punch off the end of the file\n"); - log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); + log4(OP_PUNCH_HOLE, offset, length, FL_SKIPPED); return; } @@ -994,8 +994,8 @@ do_zero_range(unsigned offset, unsigned length, int keep_size) if (length == 0) { if (!quiet && testcalls > simulatedopcount) prt("skipping zero length zero range\n"); - log4(OP_ZERO_RANGE, offset, length, FL_SKIPPED | - (keep_size ? FL_KEEP_SIZE : FL_NONE)); + log4(OP_ZERO_RANGE, offset, length, FL_SKIPPED | + (keep_size ? FL_KEEP_SIZE : FL_NONE)); return; } diff --git a/ltp/growfiles.c b/ltp/growfiles.c index 06f179f..fb91761 100644 --- a/ltp/growfiles.c +++ b/ltp/growfiles.c @@ -1455,11 +1455,12 @@ notify_others() send_signals=1; /* only send signals once */ for (ind=0; ind< Forker_npids; ind++) { - if ( Forker_pids[ind] != Pid ) + if ( Forker_pids[ind] != Pid ) { if ( Debug > 1 ) printf("%s%s: %d DEBUG2 %s/%d: Sending SIGUSR2 to pid %d\n", Progname, TagName, Pid, __FILE__, __LINE__, Forker_pids[ind]); kill(Forker_pids[ind], SIGUSR2); + } } }