Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filestore] directory handles don't survive filestore-vhost restart #2390

Open
qkrorlqr opened this issue Oct 30, 2024 · 0 comments
Open

[Filestore] directory handles don't survive filestore-vhost restart #2390

qkrorlqr opened this issue Oct 30, 2024 · 0 comments
Assignees
Labels
bug Something isn't working filestore Add this label to run only cloud/filestore build and tests on PR

Comments

@qkrorlqr
Copy link
Collaborator

Currently directory handles which are used in OpenDir, ReadDir, FsyncDir are stored in memory and don’t survive restart of filestore-vhost service.

Simple C program to reproduce the bug:

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

int main(int argc, char **argv) {
  int fd = open(argv[1], O_RDONLY);
  if (fd == -1) {
    perror("open");
    return 1;
  }
  printf("press enter: ");
	fflush(stdout);
  char buffer[1024];
  ssize_t bytes_read = read(STDIN_FILENO, buffer, sizeof(buffer));
  if (bytes_read == -1) {
    perror("read");
    return 1;
  }
  
  fsync(fd);
  DIR *dir = fdopendir(fd);
  if (dir == NULL) {
    perror("fdopendir");
    return 1;
  }
  struct dirent *entry;
  while ((entry = readdir(dir)) != NULL) {
    printf("%s\n", entry->d_name);
  }
  closedir(dir);
  return 0;
}
@qkrorlqr qkrorlqr added the filestore Add this label to run only cloud/filestore build and tests on PR label Oct 30, 2024
@qkrorlqr qkrorlqr self-assigned this Oct 30, 2024
@qkrorlqr qkrorlqr added the bug Something isn't working label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working filestore Add this label to run only cloud/filestore build and tests on PR
Projects
None yet
Development

No branches or pull requests

2 participants