← Back to team overview

kernel-packages team mailing list archive

[Bug 1341364] [NEW] cgroupfs rmdir race (regression)

 

Public bug reported:

In older utopic kernels (abi-3.15.0-6-generic), when I quickly rmdir
/a/b and then rmdir /a, it succeeds.  With the kernel in utopic, the
rmdir of cgroup /a fails with EBUSY.  This appears to be a race.

The following test program quite reliably shows the race:

#include <stdio.h>                                         
#include <stdlib.h>                                           
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <errno.h>
#include <string.h>
 
int main()
{
        int ret;
        int i;
        char path[1024], f[30];

        ret = mount("cgroup", "/mnt", "cgroup", 0, "memory");
        if (ret) {
                perror("mount");
                exit(1);
        }
              
        sprintf(path, "/mnt");
        printf("creating\n");
        for (i = 0; i < 10; i++) {
                sprintf(f, "/dir%d", i);
                strcat(path, f);
                ret = mkdir(path, 0755);
                if (ret && errno != EEXIST) {
                        perror("mkdir");
                        printf("Failed on %d\n", i);
                        umount("/mnt");
                        exit(1);
                }
        }                                      
        printf("Now removing\n");                      
        for (i = 9;  i >= 0;  i--) {                                        
                ret = rmdir(path);
                if (ret) {                               
                        perror("rmdir");                         
                        printf("Failed removing %s\n", path);
                        umount("/mnt");
                        exit(1);
                }
                char *p = strrchr(path, '/');
                *p = '\0';
        }                            
        umount("/mnt");                      
        printf("Done - success\n");
}                                  

This is also blocking promotion of the cgmanager package to utopic due
to jenkins failure:


https://jenkins.qa.ubuntu.com/job/utopic-adt-cgmanager/30/ARCH=amd64,label=adt/console

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1341364

Title:
  cgroupfs rmdir race (regression)

Status in “linux” package in Ubuntu:
  New

Bug description:
  In older utopic kernels (abi-3.15.0-6-generic), when I quickly rmdir
  /a/b and then rmdir /a, it succeeds.  With the kernel in utopic, the
  rmdir of cgroup /a fails with EBUSY.  This appears to be a race.

  The following test program quite reliably shows the race:

  #include <stdio.h>                                         
  #include <stdlib.h>                                           
  #include <sys/stat.h>
  #include <sys/types.h>
  #include <sys/mount.h>
  #include <errno.h>
  #include <string.h>
   
  int main()
  {
          int ret;
          int i;
          char path[1024], f[30];

          ret = mount("cgroup", "/mnt", "cgroup", 0, "memory");
          if (ret) {
                  perror("mount");
                  exit(1);
          }
                
          sprintf(path, "/mnt");
          printf("creating\n");
          for (i = 0; i < 10; i++) {
                  sprintf(f, "/dir%d", i);
                  strcat(path, f);
                  ret = mkdir(path, 0755);
                  if (ret && errno != EEXIST) {
                          perror("mkdir");
                          printf("Failed on %d\n", i);
                          umount("/mnt");
                          exit(1);
                  }
          }                                      
          printf("Now removing\n");                      
          for (i = 9;  i >= 0;  i--) {                                        
                  ret = rmdir(path);
                  if (ret) {                               
                          perror("rmdir");                         
                          printf("Failed removing %s\n", path);
                          umount("/mnt");
                          exit(1);
                  }
                  char *p = strrchr(path, '/');
                  *p = '\0';
          }                            
          umount("/mnt");                      
          printf("Done - success\n");
  }                                  

  This is also blocking promotion of the cgmanager package to utopic due
  to jenkins failure:

  
  https://jenkins.qa.ubuntu.com/job/utopic-adt-cgmanager/30/ARCH=amd64,label=adt/console

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1341364/+subscriptions


Follow ups

References