[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] LXC: create directory /dev/shm automatically



On Mon, Jan 28, 2013 at 02:37:11PM +0800, Gao feng wrote:
> Now we mount /dev as tmpfs and haven't created directory
> /dev/shm,so the glibc api such as shm_open/sem_open will
> create files under dir /dev.(since /dev is mounted as tmpfs)
> 
> Through these api still useable in container,but this cause
> directory /dev looks a little chaos.
> 
> This patch create directory /dev/shm automatically,the files
> created by shm_open/sem_open will stay in this directroy.
> 
> Signed-off-by: Gao feng <gaofeng cn fujitsu com>
> ---
>  src/lxc/lxc_container.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index 497539c..5150564 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -586,6 +586,13 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
>                                   "devfs", "/dev", "tmpfs", opts);
>              goto cleanup;
>          }
> +
> +        VIR_DEBUG("create directory /dev/shm for POSIX shared memory and named semphore");
> +        if (virFileMakePath("/dev/shm") < 0) {
> +            virReportSystemError(errno, "%s",
> +                                 _("Failed to mkdir /dev/shm"));
> +            goto cleanup;
> +        }
>      }
>  
>      rc = 0;

I we probably want to mount a separate tmpfs on /dev/shm really, so we can
do resource limits on /dev and /dev/shm separately.

I wonder if /dev should be devtmpfs instead of plain tmpfs too.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]