From patchwork Tue Jan 31 15:36:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 9547481 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 05BDD6016C for ; Tue, 31 Jan 2017 15:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFBFC28375 for ; Tue, 31 Jan 2017 15:37:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0A782823E; Tue, 31 Jan 2017 15:37:54 +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 lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E0582823E for ; Tue, 31 Jan 2017 15:37:53 +0000 (UTC) Received: from localhost ([::1]:39048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYaVD-0002N3-EE for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jan 2017 10:37:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYaUH-0001gp-3v for qemu-devel@nongnu.org; Tue, 31 Jan 2017 10:36:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYaUC-0005xv-PI for qemu-devel@nongnu.org; Tue, 31 Jan 2017 10:36:53 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:54890 helo=mx01.kamp.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cYaUC-0005wq-Fj for qemu-devel@nongnu.org; Tue, 31 Jan 2017 10:36:48 -0500 Received: (qmail 10583 invoked by uid 89); 31 Jan 2017 15:36:45 -0000 Received: from [195.62.97.28] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.99.2/22977. avast: 1.2.2/17010300. spamassassin: 3.4.1. Clear:RC:1(195.62.97.28):. Processed in 0.053729 secs); 31 Jan 2017 15:36:45 -0000 Received: from smtp.kamp.de (HELO submission.kamp.de) ([195.62.97.28]) by mx01.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted); 31 Jan 2017 15:36:44 -0000 X-GL_Whitelist: yes Received: (qmail 18764 invoked from network); 31 Jan 2017 15:36:44 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 31 Jan 2017 15:36:44 -0000 Received: by lieven-pc (Postfix, from userid 1000) id 4C6C620AD4; Tue, 31 Jan 2017 16:36:44 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org Date: Tue, 31 Jan 2017 16:36:34 +0100 Message-Id: <1485876994-14555-1-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:248:0:51::16 Subject: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org, Peter Lieven , mdroth@linux.vnet.ibm.com, ct@flyingcircus.io Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP the current implementation fails if we try to freeze an already frozen filesystem. This can happen if a filesystem is mounted more than once (e.g. with a bind mount). Suggested-by: Christian Theune Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven --- qga/commands-posix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index ea37c09..73d93eb 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1243,6 +1243,9 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, * filesystems may not implement fsfreeze for less obvious reasons. * these will report EOPNOTSUPP. we simply ignore these when tallying * the number of frozen filesystems. + * if a filesystem is mounted more than once (aka bind mount) a + * consecutive attempt to freeze an already frozen filesystem will + * return EBUSY. * * any other error means a failure to freeze a filesystem we * expect to be freezable, so return an error in those cases @@ -1250,7 +1253,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, */ ret = ioctl(fd, FIFREEZE); if (ret == -1) { - if (errno != EOPNOTSUPP) { + if (errno != EOPNOTSUPP && errno != EBUSY) { error_setg_errno(errp, errno, "failed to freeze %s", mount->dirname); close(fd);