* [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
@ 2017-01-31 15:36 Peter Lieven
2017-02-02 21:41 ` Paolo Bonzini
0 siblings, 1 reply; 8+ messages in thread
From: Peter Lieven @ 2017-01-31 15:36 UTC (permalink / raw)
To: qemu-devel; +Cc: mdroth, ct, Peter Lieven, qemu-stable
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 <ct@flyingcircus.io>
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
---
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);
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-01-31 15:36 [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem Peter Lieven
@ 2017-02-02 21:41 ` Paolo Bonzini
2017-02-03 8:18 ` Christian Theune
2017-02-03 8:20 ` Peter Lieven
0 siblings, 2 replies; 8+ messages in thread
From: Paolo Bonzini @ 2017-02-02 21:41 UTC (permalink / raw)
To: Peter Lieven, qemu-devel; +Cc: qemu-stable, mdroth, ct
On 31/01/2017 07:36, Peter Lieven wrote:
> 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 <ct@flyingcircus.io>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
What happens when you thaw?
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-02-02 21:41 ` Paolo Bonzini
@ 2017-02-03 8:18 ` Christian Theune
2017-02-03 8:20 ` Peter Lieven
1 sibling, 0 replies; 8+ messages in thread
From: Christian Theune @ 2017-02-03 8:18 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Peter Lieven, qemu-devel, qemu-stable, mdroth
[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]
Hi,
to clarify: I guess you ask about what happens when you thaw with the same condition: a filesystem that is mounted multiple times.
When I created the patch initially I looked at the thaw code and found it to already expect that thaws may happen outside its control and that the error handling is fine.
The code definitely does not have an early exit upon encountering an issue with thawing/double thawing.
Christian
> On 2 Feb 2017, at 22:41, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
>
> On 31/01/2017 07:36, Peter Lieven wrote:
>> 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 <ct@flyingcircus.io>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Peter Lieven <pl@kamp.de>
>
> What happens when you thaw?
>
> Paolo
--
Christian Theune · ct@flyingcircus.io · +49 345 219401 0
Flying Circus Internet Operations GmbH · http://flyingcircus.io
Forsterstraße 29 · 06112 Halle (Saale) · Deutschland
HR Stendal HRB 21169 · Geschäftsführer: Christian. Theune, Christian. Zagrodnick
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 496 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-02-02 21:41 ` Paolo Bonzini
2017-02-03 8:18 ` Christian Theune
@ 2017-02-03 8:20 ` Peter Lieven
2017-02-03 8:22 ` Christian Theune
2017-02-03 18:31 ` Paolo Bonzini
1 sibling, 2 replies; 8+ messages in thread
From: Peter Lieven @ 2017-02-03 8:20 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: qemu-stable, mdroth, ct
Am 02.02.2017 um 22:41 schrieb Paolo Bonzini:
>
> On 31/01/2017 07:36, Peter Lieven wrote:
>> 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 <ct@flyingcircus.io>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Peter Lieven <pl@kamp.de>
> What happens when you thaw?
>
> Paolo
If you try to THAW an unfrozen FS you get EINVAL.
The current code thaws until an error is returned.
So it should work as is.
If you feel uncomfortable with the EBUSY approach. The other idea would
be to track all devices which have been successfully frozen and skip consecutive
tries to freeze them.
Peter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-02-03 8:20 ` Peter Lieven
@ 2017-02-03 8:22 ` Christian Theune
2017-02-03 8:36 ` Peter Lieven
2017-02-03 18:31 ` Paolo Bonzini
1 sibling, 1 reply; 8+ messages in thread
From: Christian Theune @ 2017-02-03 8:22 UTC (permalink / raw)
To: Peter Lieven; +Cc: Paolo Bonzini, qemu-devel, qemu-stable, mdroth
[-- Attachment #1: Type: text/plain, Size: 848 bytes --]
Hi,
> On 3 Feb 2017, at 09:20, Peter Lieven <pl@kamp.de> wrote:
>
> If you try to THAW an unfrozen FS you get EINVAL.
>
> The current code thaws until an error is returned.
>
>
> So it should work as is.
>
>
> If you feel uncomfortable with the EBUSY approach. The other idea would
>
> be to track all devices which have been successfully frozen and skip consecutive
>
> tries to freeze them.
Which will be subject to race conditions as other processes may call freeze/thaw on any device. Those are completely out of our control.
Christian
--
Christian Theune · ct@flyingcircus.io · +49 345 219401 0
Flying Circus Internet Operations GmbH · http://flyingcircus.io
Forsterstraße 29 · 06112 Halle (Saale) · Deutschland
HR Stendal HRB 21169 · Geschäftsführer: Christian. Theune, Christian. Zagrodnick
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 496 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-02-03 8:22 ` Christian Theune
@ 2017-02-03 8:36 ` Peter Lieven
0 siblings, 0 replies; 8+ messages in thread
From: Peter Lieven @ 2017-02-03 8:36 UTC (permalink / raw)
To: Christian Theune; +Cc: Paolo Bonzini, qemu-devel, qemu-stable, mdroth
Am 03.02.2017 um 09:22 schrieb Christian Theune:
> Hi,
>
>> On 3 Feb 2017, at 09:20, Peter Lieven <pl@kamp.de <mailto:pl@kamp.de>> wrote:
>>
>> If you try to THAW an unfrozen FS you get EINVAL.
>>
>> The current code thaws until an error is returned.
>>
>>
>> So it should work as is.
>>
>>
>> If you feel uncomfortable with the EBUSY approach. The other idea would
>>
>> be to track all devices which have been successfully frozen and skip consecutive
>>
>> tries to freeze them.
>
> Which will be subject to race conditions as other processes may call freeze/thaw on any device. Those are completely out of our control.
That will always be out of control. If we freeze the FS and another process thaws it, we snapshot an unfrozen fs and believe it is frozen.
I think the EBUSY approach is fine. If I look at the documentation of the thaw in the code it seems that the behaviour of the linux kernel changed. It seems
that it was possible to call FIFREEZE multiple times on an FS and this required multiple FITHAWs to unfreeze it.
Peter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-02-03 8:20 ` Peter Lieven
2017-02-03 8:22 ` Christian Theune
@ 2017-02-03 18:31 ` Paolo Bonzini
2017-02-17 13:02 ` Peter Lieven
1 sibling, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2017-02-03 18:31 UTC (permalink / raw)
To: Peter Lieven, qemu-devel; +Cc: qemu-stable, mdroth, ct
On 03/02/2017 00:20, Peter Lieven wrote:
> Am 02.02.2017 um 22:41 schrieb Paolo Bonzini:
>>
>> On 31/01/2017 07:36, Peter Lieven wrote:
>>> 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 <ct@flyingcircus.io>
>>> Cc: qemu-stable@nongnu.org
>>> Signed-off-by: Peter Lieven <pl@kamp.de>
>> What happens when you thaw?
>>
>> Paolo
>
> If you try to THAW an unfrozen FS you get EINVAL.
> The current code thaws until an error is returned.
>
> So it should work as is.
>
> If you feel uncomfortable with the EBUSY approach. The other idea would
> be to track all devices which have been successfully frozen and skip consecutive
> tries to freeze them.
No, just asking.
Reeviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem
2017-02-03 18:31 ` Paolo Bonzini
@ 2017-02-17 13:02 ` Peter Lieven
0 siblings, 0 replies; 8+ messages in thread
From: Peter Lieven @ 2017-02-17 13:02 UTC (permalink / raw)
To: mdroth; +Cc: Paolo Bonzini, qemu-devel, qemu-stable, ct
Am 03.02.2017 um 19:31 schrieb Paolo Bonzini:
>
> On 03/02/2017 00:20, Peter Lieven wrote:
>> Am 02.02.2017 um 22:41 schrieb Paolo Bonzini:
>>> On 31/01/2017 07:36, Peter Lieven wrote:
>>>> 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 <ct@flyingcircus.io>
>>>> Cc: qemu-stable@nongnu.org
>>>> Signed-off-by: Peter Lieven <pl@kamp.de>
>>> What happens when you thaw?
>>>
>>> Paolo
>> If you try to THAW an unfrozen FS you get EINVAL.
>> The current code thaws until an error is returned.
>>
>> So it should work as is.
>>
>> If you feel uncomfortable with the EBUSY approach. The other idea would
>> be to track all devices which have been successfully frozen and skip consecutive
>> tries to freeze them.
> No, just asking.
>
> Reeviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Ping, Michael can you pick this up please.
Thanks,
Peter
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-02-17 13:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 15:36 [Qemu-devel] [PATCH] qga: ignore EBUSY when freezing a filesystem Peter Lieven
2017-02-02 21:41 ` Paolo Bonzini
2017-02-03 8:18 ` Christian Theune
2017-02-03 8:20 ` Peter Lieven
2017-02-03 8:22 ` Christian Theune
2017-02-03 8:36 ` Peter Lieven
2017-02-03 18:31 ` Paolo Bonzini
2017-02-17 13:02 ` Peter Lieven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).