Comment 4 for bug 210581

Revision history for this message
Chris Elford (chris-l-elford) wrote :

I cannot publically share the actual app which is quite large but I was able to create a simple reproducer which should be even better... :-)

When the file is on unionfs this basically hangs during the ftruncate call and dmesg reports the error. The process becomes pretty unkillable.

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

#define FNAME "/tmp/myfile"

main() {
  int f,s;
  f=open(FNAME,O_RDWR|O_CREAT|O_EXCL,0600);
  fprintf(stderr,"open f=%d\n",f);
  s=unlink(FNAME);
  fprintf(stderr,"unlink status=%d\n",s);
  s=write(f,"hi",3);
  fprintf(stderr,"write status=%d\n",s);
  s=ftruncate(f,0);
  fprintf(stderr,"truncate status=%d\n",s);
}