Linux Container Development
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
To: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [RFC] Payloads and transient filesystem support for user-cr
Date: Thu, 03 Mar 2011 09:35:43 +0100	[thread overview]
Message-ID: <4D6F52DF.1040808@free.fr> (raw)
In-Reply-To: <877hch6oi2.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>

On 03/03/2011 01:23 AM, Dan Smith wrote:
> DL>  The posix semaphore use the mapped deleted hardlinked files.
>
> DL>  AFAIK, the current implementation do not support that, no ?
> DL>  How is it possible to CR programs using sem_* operations in this case ?
>
> You're right.  This addresses the problem of /dev/shm/sem.foo going away
> when the container's /dev/shm mount is destroyed.  It does not address
> the fact that the mmap()'d unlinked file is restored as an anonymous
> region and therefore becomes disjoint with the one on-disk.  I expect
> the evolution of the unlinked files patches will resolve that.

The mapped file is deleted but hardlinked.

> Our naive tests are not discriminating enough to make this distinction
> at the moment, which certainly needs to be resolved :)

Well a simple test program doing sem_* operations should have spotted 
the problem.

Let me know for this one:

#include <stdio.h>
#include <semaphore.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define SEM "/dummy_sem_open"
int main(int argc, char *argv[])
{
         sem_t *sem1, *sem2;

         sem_unlink(SEM);
         sem1 = sem_open(SEM, O_CREAT | O_EXCL, 0600, 1);
         if (sem1 == SEM_FAILED) {
                 perror("sem_open (1)");
                 return -1;
         }

         printf("checkpoint/restart and press enter");
         getchar();

         sem2 = sem_open(SEM, 0);
         if (sem2 == SEM_FAILED) {
                 perror("sem_open (2)");
                 return -1;
         }

         {
                 int val;
                 if (sem_getvalue(sem2, &val)) {
                         perror("sem_getvalue");
                         return -1;
                 }

                 printf("value is %d\n", val);
         }

         if (sem1 != sem2) {
                 fprintf(stderr, "sem addresses differ %p <> %p\n", 
sem1, sem2);
                 return -1;
         }

         return 0;
}

  parent reply	other threads:[~2011-03-03  8:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-02 21:35 [RFC] Payloads and transient filesystem support for user-cr Dan Smith
     [not found] ` <1299101725-17603-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-03-02 21:35   ` [PATCH 1/3] Make extract_headers.sh grab setns as well Dan Smith
2011-03-02 21:35   ` [PATCH 2/3] Export some things from restart.c Dan Smith
2011-03-02 21:35   ` [PATCH 3/3] [RFC] Add transient filesystem support to user-cr Dan Smith
2011-03-02 22:05   ` [RFC] Payloads and transient filesystem support for user-cr Daniel Lezcano
2011-03-03  0:23     ` Dan Smith
     [not found]       ` <877hch6oi2.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2011-03-03  8:35         ` Daniel Lezcano [this message]
2011-03-03 14:41           ` Dan Smith
     [not found]             ` <87vd005ks5.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2011-03-03 18:18               ` Daniel Lezcano
     [not found]                 ` <4D6FDB71.7050603-GANU6spQydw@public.gmane.org>
2011-03-03 18:30                   ` Dan Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D6F52DF.1040808@free.fr \
    --to=daniel.lezcano-ganu6spqydw@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox