From patchwork Thu Nov 2 10:15:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10038327 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 3965A603B5 for ; Thu, 2 Nov 2017 10:15:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27EA628EDE for ; Thu, 2 Nov 2017 10:15:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1542728EE1; Thu, 2 Nov 2017 10:15:29 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 B29C828EDE for ; Thu, 2 Nov 2017 10:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755348AbdKBKP1 (ORCPT ); Thu, 2 Nov 2017 06:15:27 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:55764 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755358AbdKBKO6 (ORCPT ); Thu, 2 Nov 2017 06:14:58 -0400 Received: by mail-wm0-f67.google.com with SMTP id y83so10077199wmc.4; Thu, 02 Nov 2017 03:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+jLe1d2ypAbXTMuqkORm7c49I1VDUVjwUxuNorEDDNk=; b=RNJh53jEFgVzxF2JBhp8Vjivuf1BI6vHCZ28vRTich3vKeEueMr4PtigQ3x1P3FqpY uST0qxHNG1pLeFOqi+3tHeADv5oS9I4BzlvIBCM52qXXyj0OeH8eKhKxSdfhQ5ngPus1 wu5iZZZGOnArfLTF2vSoE6qZMNQ8uXWSMC4BANdYkTJZ1iBCCMP4aT6lNC4V8TUzXSFw 8ST1HAwIAWni/tygGZxqQdSkjKn8OQP8ZRl0i7sL9GSuC8qE7yc/BKzaV8t/1H5ODMs1 EV9SCu1B7L3qeu/cbI6vwEWv7G688jpXgUFuVe//I2soNZExr+syV6ydVPGnANxN2iok KIRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+jLe1d2ypAbXTMuqkORm7c49I1VDUVjwUxuNorEDDNk=; b=BcQE9RZz7jYzebVIPzc2MEVvGa906fb+/cLBWl7MyMjYK1X6Op5g9P+eQSAyfcZJPG 35K9Mtxyvqh2vJ6k1VpaPT19+IfnwYUMqN/GgQwAEthf/opEEpcB23Rhxtpip4Z5NECf ZdyP7nuID+3XR73PvYPSCMnuMwhY6G8kttjQCLTEBNJjyL4pfhvG6c1I+CNigvXcSKu9 5pVhlQgOux4+mDVGY4GJUYQHmAdmp8KX+P7cT9k+L/yx8bAj7YT1VrpSA0iQtlWl4H1Y JXbl7K5ZnA4EtBXCO+mTYFQItepwBMlX8YShMJiqSQJDY7ZiqGJB5keCZFkHnGiTh7T+ ejuA== X-Gm-Message-State: AJaThX4y/8JC5+l1dms+3GvbojjY7HisWhIfxQB1G1u/rvYZGsJ6OvQl +Y25ima59NzX54ItcFhc6go= X-Google-Smtp-Source: ABhQp+Rp77qvaZPjuiRVE3GaIAvPVLoXzuDlDlOfjZb4R40pp3OZCIhVvnpOwQACARrn3Kht7Y9+zQ== X-Received: by 10.28.95.70 with SMTP id t67mr1265556wmb.86.1509617696637; Thu, 02 Nov 2017 03:14:56 -0700 (PDT) Received: from localhost.localdomain ([31.210.182.123]) by smtp.gmail.com with ESMTPSA id e6sm7190026wrg.53.2017.11.02.03.14.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Nov 2017 03:14:56 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Jeff Layton , "J . Bruce Fields" , Miklos Szeredi , fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org Subject: [PATCH 1/7] open_by_handle: add filename to error reports Date: Thu, 2 Nov 2017 12:15:33 +0200 Message-Id: <1509617739-15744-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509617739-15744-1-git-send-email-amir73il@gmail.com> References: <1509617739-15744-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This makes it easier to understand which of the tests failed when testing on overlay lower and upper files. Signed-off-by: Amir Goldstein --- src/open_by_handle.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/open_by_handle.c b/src/open_by_handle.c index 63ebdac..52973c6 100644 --- a/src/open_by_handle.c +++ b/src/open_by_handle.c @@ -156,7 +156,7 @@ int main(int argc, char **argv) sprintf(fname2, "%s/link%06d", test_dir, i); fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - printf("Warning (%s,%d), open(%s) failed.\n", __FILE__, __LINE__, fname); + strcat(fname, ": open"); perror(fname); return EXIT_FAILURE; } @@ -164,7 +164,8 @@ int main(int argc, char **argv) /* blow up leftovers hardlinks if they exist */ ret = unlink(fname2); if (ret < 0 && errno != ENOENT) { - perror("unlink"); + strcat(fname2, ": unlink"); + perror(fname2); return EXIT_FAILURE; } } @@ -178,7 +179,8 @@ int main(int argc, char **argv) handle[i].fh.handle_bytes = MAX_HANDLE_SZ; ret = name_to_handle_at(AT_FDCWD, fname, &handle[i].fh, &mount_id, 0); if (ret < 0) { - perror("name_to_handle"); + strcat(fname, ": name_to_handle"); + perror(fname); return EXIT_FAILURE; } } @@ -193,7 +195,8 @@ int main(int argc, char **argv) sprintf(fname2, "%s/link%06d", test_dir, i); ret = link(fname, fname2); if (ret < 0) { - perror("link"); + strcat(fname2, ": link"); + perror(fname2); return EXIT_FAILURE; } } @@ -204,14 +207,16 @@ int main(int argc, char **argv) sprintf(fname2, "%s/link%06d", test_dir, i); ret = unlink(fname); if (ret < 0) { - perror("unlink"); + strcat(fname, ": unlink"); + perror(fname); return EXIT_FAILURE; } /* with -d flag, delete the hardlink if it exists */ if (!nlink) ret = unlink(fname2); if (ret < 0 && errno != ENOENT) { - perror("unlink"); + strcat(fname2, ": unlink"); + perror(fname2); return EXIT_FAILURE; } } @@ -246,11 +251,13 @@ int main(int argc, char **argv) } else if (!nlink && fd < 0 && (errno == ENOENT || errno == ESTALE)) { continue; } + sprintf(fname, "%s/file%06d", test_dir, i); if (fd >= 0) { - printf("open_by_handle(%d) opened an unlinked file!\n", i); + printf("open_by_handle(%s) opened an unlinked file!\n", fname); close(fd); } else { - printf("open_by_handle(%d) returned %d incorrectly on %s file!\n", i, errno, + printf("open_by_handle(%s) returned %d incorrectly on %s file!\n", + fname, errno, nlink ? "a linked" : "an unlinked"); } failed++;