> > What would be the next steps for this investigation ? > > > > I need to find some time and to debug the reason for 9p open failure > so we can make sure the problem is in 9p code and report more details > of the bug to 9p maintainers, but since a simple reproducer exists, > they can also try to reproduce the issue right now. FWIW, the attached reproducer mimics git clone rename_over pattern closer. It reproduces fanotify_read() errors sometimes, not always, with either CLOSE_WRITE or OPEN_PERM | CLOSE_WRITE. maybe CLOSE_WRITE alone has better odds - I'm not sure. Thanks, Amir.
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <errno.h> #include <pthread.h> void *thread(void *ptr) { char filename[10] = {}; const char *new_filename = "config"; const char *content = "Hello, this is a test with file rename operation.\n"; char buffer[100]; int fd; ssize_t bytes_read; int counter=0; fprintf(stderr,"Thread %ld started\n", (long)ptr); sprintf(filename,"config.%ld", (long)ptr); retry: // Create a new file and write to it fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0644); if (fd == -1) { perror("Failed to create file"); return NULL; } if (write(fd, content, strlen(content)) == -1) { perror("Failed to write to file"); close(fd); return NULL; } close(fd); // Rename the file if (rename(filename, new_filename) != 0) { perror("Failed to rename file"); return NULL; } fd = open(new_filename, O_RDONLY); if (fd == -1) { perror("Failed to open renamed file"); return NULL; } bytes_read = read(fd, buffer, sizeof(buffer) - 1); if (bytes_read == -1) { perror("Failed to read from file"); close(fd); return NULL; } buffer[bytes_read] = '\0'; // Null-terminate the buffer close(fd); // Open the renamed file and read the content if (counter++ < 100) goto retry; printf("File saved %d iterations\n", counter); // Print the content printf("Content of %s:\n%s", new_filename, buffer); return ptr; } int main() { pthread_t th[10]; long i; for (i = 0; i < 10; i++) pthread_create(&th[i], NULL, *thread, (void *)i); for (i = 0; i < 10; i++) pthread_join(th[i] ,NULL); return EXIT_SUCCESS; }