From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751523AbdHFUOC (ORCPT ); Sun, 6 Aug 2017 16:14:02 -0400 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:52790 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbdHFUN7 (ORCPT ); Sun, 6 Aug 2017 16:13:59 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: Alex Ng , Vyronas Tsingaras , "K. Y. Srinivasan" Subject: [PATCH 1/5] Tools: hv: vss: Skip freezing filesystems backed by loop Date: Sun, 6 Aug 2017 13:12:52 -0700 Message-Id: <1502050376-23662-1-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1502050348-23624-1-git-send-email-kys@exchange.microsoft.com> References: <1502050348-23624-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfGeuFpaOpLzHhL5eg4u39Ufo9P4qgJnI9bZComEstQN52jIS/LiPBLe021kdaDFZSJx9BqEUONqKekDE4DVJJSI5g2+GUvk0d6wywhzB/Rwk4+vS7Vjj DRI68hApZtQJtYIYIdx2S3rGBgmnIdQe683gMRivFv95FOnNPHJhCA9F+yipSJtYGIbhG9k06F0bC+3hiWMkSzIiaoAf0sGUJhZ1qdI8TKNWKz/tQgbwGrHO WuC1F3zmjyYiD3tUAH07zslMutpYC4xoOh77y/8+pqDdJTVBi1SOWk1+8WbRQx1yqkx1fBBKWzm9nAbDgO6NTwH+0vVU2eNUt1kv7MExT7w8Rpttb2yTQrNI wkoCEC7uigs9LMaAOuaCm831jC/myIZVcNi8tuqnlnN8H+VmlxFCt4ZxAeyTPVWPpcjQX4ndtxkfmWCpdEG++60VcHYDr+jqWzy3xQDWhduyT8WnYelov6v5 ZqTXBYCrT18t2qEoZeO3vwIsKjCfLbUumiI9wOO0r7CSFMadvrr//zVGKP4wmJjuSc3wI1qtRDCaFca2/OkWZiZHTWu44peXMXQLt4ZurD7ziliGcW+Mb4bc dZU4GCwv1MUHZBMWBRUPdBEw Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Ng Since a loop device is backed by a file, a backup will already result in its parent filesystem being frozen. It's sufficient to just freeze the parent filesystem, so we can skip the loop device. This avoids a situation where a loop device and its parent filesystem are both frozen and then thawed out of order. For example, if the loop device is enumerated first, we would thaw it while its parent filesystem is still frozen. The thaw operation fails and the loop device remains frozen. Signed-off-by: Alex Ng Signed-off-by: Vyronas Tsingaras Signed-off-by: K. Y. Srinivasan --- tools/hv/hv_vss_daemon.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c index 7ba5419..b2b4ebf 100644 --- a/tools/hv/hv_vss_daemon.c +++ b/tools/hv/hv_vss_daemon.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +72,7 @@ static int vss_operate(int operation) char match[] = "/dev/"; FILE *mounts; struct mntent *ent; + struct stat sb; char errdir[1024] = {0}; unsigned int cmd; int error = 0, root_seen = 0, save_errno = 0; @@ -92,6 +95,10 @@ static int vss_operate(int operation) while ((ent = getmntent(mounts))) { if (strncmp(ent->mnt_fsname, match, strlen(match))) continue; + if (stat(ent->mnt_fsname, &sb) == -1) + continue; + if (S_ISBLK(sb.st_mode) && major(sb.st_rdev) == LOOP_MAJOR) + continue; if (hasmntopt(ent, MNTOPT_RO) != NULL) continue; if (strcmp(ent->mnt_type, "vfat") == 0) -- 1.7.1