From patchwork Tue Dec 17 15:25:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 11297917 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA08E1593 for ; Tue, 17 Dec 2019 15:25:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7B9F2072D for ; Tue, 17 Dec 2019 15:25:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20150623.gappssmtp.com header.i=@toxicpanda-com.20150623.gappssmtp.com header.b="T1WAQs5i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727681AbfLQPZK (ORCPT ); Tue, 17 Dec 2019 10:25:10 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:44629 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbfLQPZJ (ORCPT ); Tue, 17 Dec 2019 10:25:09 -0500 Received: by mail-qv1-f67.google.com with SMTP id n8so4300928qvg.11 for ; Tue, 17 Dec 2019 07:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=2b08/BPBT5+Se5+XLgJ1e3D5ANtbvG4Mq6WP54HCssA=; b=T1WAQs5iR64TVlBoCYh3Lc7/s++gnLZ19/+22a5m6CFiNsGSxPXp9ERdaMUYvHkvMp JUsGdURkssKvo8OGGgggqNqzqtEBdN6W3SWwJ3ZHTbkyJEBuQEMqlM4VohP6Zb5kC9mZ PkGtKyaRNgSHzO9oFAkGTo8Ma+Bh64mpFIljT5o8xWUJid6UT5bhnJFXAbxqUxBFt0nn nhREa8UvsxdqDtyGd/WPAb9qHIkA4YJflul1zsh4yNiaRwd8aOQQqdb4fgIJm3wu6+e/ F50OmKTejbq9Cda4lFiCeC9DoQ29n02teLgEBmNzJ0T1jo3x6zjNuIlj3G18IOI9O6+8 M39g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=2b08/BPBT5+Se5+XLgJ1e3D5ANtbvG4Mq6WP54HCssA=; b=LjhqFlfGv/QF7k4qKVMDV0lgL0AuZgkInTyUn+36IRkgtYpEiAFbo8yzM7bCuzavHa 7kIw2121TO52NUhjMSoDpGj56PVyT3kQ4W7WtSmbfboBDmDsXPlim5iYWPXtVFhNXoJf 6kXl/e34GvIPDTQprk+h9GMQIVsu64wnqRralmaaZBPhU9TZPZ2WT5O50JSBPX5YCnU6 P1SfOBDjfg/YWIGf9gd9cuE4yaC3FMoYTrF7H5BSOjw1aiRYe5eGV9egOSRff2gnTD6n kuLUxpEvIYkbDN8zkWJopLWFUgUWg4L+BvcqZR696oaa0lFkTfpZMAbN5UurUfv9Rpms 8UKA== X-Gm-Message-State: APjAAAXPhtHmuPzF7BeaplFUpWl7uU6PVhU78LsYSVUpQGXV2I4G7qy4 Tw8syx833DoruG4PD/BMu3gg2N4nko1Xgg== X-Google-Smtp-Source: APXvYqwXD738AIcmwlgKJbg8R00xEp3Ocl5Lsc4rPnmW/F4qDvbGXFe4p5TdeGBF0Wp5DXJoZ9oI5Q== X-Received: by 2002:a05:6214:8cb:: with SMTP id da11mr4952760qvb.228.1576596308042; Tue, 17 Dec 2019 07:25:08 -0800 (PST) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id k50sm8404355qtc.90.2019.12.17.07.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 07:25:07 -0800 (PST) From: Josef Bacik To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] src/fssum: skip subvolumes when building a sum Date: Tue, 17 Dec 2019 10:25:05 -0500 Message-Id: <20191217152505.44650-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org With the snapshot/subvolume support added to fsstress I've been seeing random failures with our send/receive related tests. This is because fssum is summing the path with the subvolumes for our test fs'es that are generated by fsstress. But with send/receive it skips subvolumes, which makes the sums mismatch. Fix this by skipping directories that do not match our st_dev, which is how we differentiate subvolumes in btrfs. Signed-off-by: Josef Bacik Reviewed-by: Filipe Manana --- src/fssum.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fssum.c b/src/fssum.c index 6ba0a95c..a243839a 100644 --- a/src/fssum.c +++ b/src/fssum.c @@ -517,6 +517,12 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in) int excl; sum_file_data_t sum_file_data = flags[FLAG_STRUCTURE] ? sum_file_data_strict : sum_file_data_permissive; + struct stat64 dir_st; + + if (fstat64(dirfd, &dir_st)) { + perror("fstat"); + exit(-1); + } d = fdopendir(dirfd); if (!d) { @@ -570,6 +576,11 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in) path_prefix, path, strerror(errno)); exit(-1); } + + /* We are crossing into a different subvol, skip this subtree. */ + if (st.st_dev != dir_st.st_dev) + goto next; + sum_add_u64(&meta, level); sum_add(&meta, namelist[i], strlen(namelist[i])); if (!S_ISDIR(st.st_mode))