Changeset
src/lxc/lxc_container.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Git apply log
Switched to a new branch '20180415153011.822-1-rstoyanov1@gmail.com'
Applying: lxc: s/subtreee/subtree/
Using index info to reconstruct a base tree...
M	src/lxc/lxc_container.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: lxc: Clean up /.oldroot
To https://github.com/patchew-project/libvirt
 + 2ae842c...93ae57d patchew/20180415153011.822-1-rstoyanov1@gmail.com -> patchew/20180415153011.822-1-rstoyanov1@gmail.com (forced update)
Test passed: syntax-check

loading

[libvirt] [PATCH 0/2] Trivial fixes
Posted by Radostin Stoyanov, 13 weeks ago
Radostin Stoyanov (2):
  lxc: s/subtreee/subtree/
  lxc: Clean up /.oldroot

 src/lxc/lxc_container.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] lxc: s/subtreee/subtree/
Posted by Radostin Stoyanov, 13 weeks ago
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
---
 src/lxc/lxc_container.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 532fd0be0..665b93a0a 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -574,7 +574,7 @@ static int lxcContainerUnmountSubtree(const char *prefix,
     const char *failedUmount = NULL;
     int ret = -1;
 
-    VIR_DEBUG("Unmount subtreee from %s", prefix);
+    VIR_DEBUG("Unmount subtree from %s", prefix);
 
     if (virFileGetMountReverseSubtree("/proc/mounts", prefix,
                                       &mounts, &nmounts) < 0)
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] lxc: s/subtreee/subtree/
Posted by Ján Tomko, 13 weeks ago
On Sun, Apr 15, 2018 at 04:30:10PM +0100, Radostin Stoyanov wrote:
>Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
>---
> src/lxc/lxc_container.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: J�n Tomko <jtomko@redhat.com>

And pushed.

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] lxc: Clean up /.oldroot
Posted by Radostin Stoyanov, 13 weeks ago
Remove the /.oldroot directory after it has been unmounted (at the end
of lxcContainerSetupPivotRoot). Ignore errors silently.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
---
 src/lxc/lxc_container.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 665b93a0a..dd4e38703 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1811,6 +1811,9 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
     if (lxcContainerUnmountSubtree("/.oldroot", true) < 0)
         goto cleanup;
 
+    if (virFileRemove("/.oldroot", 0, 0) < 0)
+        VIR_DEBUG("Failed to remove /.oldroot after start");
+
     ret = 0;
 
  cleanup:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] lxc: Clean up /.oldroot
Posted by Daniel P. Berrangé, 13 weeks ago
On Sun, Apr 15, 2018 at 04:30:11PM +0100, Radostin Stoyanov wrote:
> Remove the /.oldroot directory after it has been unmounted (at the end
> of lxcContainerSetupPivotRoot). Ignore errors silently.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
> ---
>  src/lxc/lxc_container.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index 665b93a0a..dd4e38703 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -1811,6 +1811,9 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
>      if (lxcContainerUnmountSubtree("/.oldroot", true) < 0)
>          goto cleanup;
>  
> +    if (virFileRemove("/.oldroot", 0, 0) < 0)
> +        VIR_DEBUG("Failed to remove /.oldroot after start");
> +

I think this introduces a race condition. There can be two containers
with the same root filesystem. If we start both at the same time, then
this deletion of /.oldroot can cause the other contanier to fail to
start if it saw that /.oldroot already existed & it thus tried to skip
mkdir.

Leaving the empty directory is harmless IMHO

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] lxc: Clean up /.oldroot
Posted by Radostin Stoyanov, 13 weeks ago
On 16/04/18 10:33, Daniel P. Berrangé wrote:
> On Sun, Apr 15, 2018 at 04:30:11PM +0100, Radostin Stoyanov wrote:
>> Remove the /.oldroot directory after it has been unmounted (at the end
>> of lxcContainerSetupPivotRoot). Ignore errors silently.
>>
>> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
>> ---
>>  src/lxc/lxc_container.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
>> index 665b93a0a..dd4e38703 100644
>> --- a/src/lxc/lxc_container.c
>> +++ b/src/lxc/lxc_container.c
>> @@ -1811,6 +1811,9 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
>>      if (lxcContainerUnmountSubtree("/.oldroot", true) < 0)
>>          goto cleanup;
>>  
>> +    if (virFileRemove("/.oldroot", 0, 0) < 0)
>> +        VIR_DEBUG("Failed to remove /.oldroot after start");
>> +
> I think this introduces a race condition. There can be two containers
> with the same root filesystem. If we start both at the same time, then
> this deletion of /.oldroot can cause the other contanier to fail to
> start if it saw that /.oldroot already existed & it thus tried to skip
> mkdir.
Thank you for the review, I hadn't thought about this case.
> Leaving the empty directory is harmless IMHO
I agree that leaving the empty directory is harmless.

Regards,
Radostin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list