From: Tom I. H. <ti...@ha...> - 2016-01-14 14:01:58
|
Piotr Robert Konopelko <pio...@mo...> writes: > (mount) use direct I/O as a default mode on Mac OS X (due to > keep_cache bug in kernel/fuse) > [...] > (mount) use direct I/O as a default mode on FreeBSD (due to keep_cache > bug in kernel/fuse) Do you have any more information on this? And maybe a way to test whether one has this bug? I'm running MooseFS 3 on NetBSD, and I'm wondering whether I ought to do the same thing there. If the problem is in the kernel, as opposed to the userland FUSE software, we probably don't have it... Meanwhile, here's a couple of NetBSD patches I use. The /proc file system in NetBSD is modeled on the one in Linux, but is slightly different: under NetBSD, 'cat /proc/*/status' is a sort of ps. ;) -tih --- mfsmount/getgroups.c.orig 2016-01-13 18:37:01.000000000 +0100 +++ mfsmount/getgroups.c 2016-01-14 08:59:16.000000000 +0100 @@ -45,11 +45,15 @@ static int keep_alive; uint32_t get_groups(pid_t pid,gid_t gid,uint32_t **gidtab) { -#if defined(__linux__) +#if defined(__linux__) || defined(__NetBSD__) // Linux - supplementary groups are in file: // /proc/<PID>/status // line: // Groups: <GID1> <GID2> <GID3> ... +// +// NetBSD - supplementary groups are in file: +// /proc/<PID>/status +// as comma separated list of gids at end of (single) line. char proc_filename[50]; char linebuff[4096]; char *ptr; @@ -67,11 +71,18 @@ return 1; } while (fgets(linebuff,4096,fd)) { +#if defined(__NetBSD__) + if ((ptr = strrchr(linebuff, ' '))) { + if (strlen(linebuff) > (2 * strlen(ptr) + 8)) { + sprintf(linebuff, "Groups: %s", ptr); + } + } +#endif if (strncmp(linebuff,"Groups:",7)==0) { gcount = 1; ptr = linebuff+7; do { - while (*ptr==' ' || *ptr=='\t') { + while (*ptr==' ' || *ptr=='\t' || *ptr==',') { ptr++; } if (*ptr>='0' && *ptr<='9') { @@ -80,14 +91,14 @@ gcount++; } } - } while (*ptr==' ' || *ptr=='\t'); + } while (*ptr==' ' || *ptr=='\t' || *ptr==','); *gidtab = malloc(sizeof(uint32_t)*gcount); passert(*gidtab); (*gidtab)[0] = gid; n = 1; ptr = linebuff+7; do { - while (*ptr==' ' || *ptr=='\t') { + while (*ptr==' ' || *ptr=='\t' || *ptr==',') { ptr++; } if (*ptr>='0' && *ptr<='9') { @@ -97,7 +108,7 @@ n++; } } - } while ((*ptr==' ' || *ptr=='\t') && n<gcount); + } while ((*ptr==' ' || *ptr=='\t' || *ptr==',') && n<gcount); fclose(fd); return n; } --- mfsmount/sustained_inodes.c.orig 2016-01-12 08:20:34.000000000 +0100 +++ mfsmount/sustained_inodes.c 2016-01-14 09:08:00.000000000 +0100 @@ -130,7 +130,7 @@ } -#if defined(__linux__) +#if defined(__linux__) || defined(__NetBSD__) #include <dirent.h> #elif defined(__APPLE__) #include <sys/types.h> @@ -150,7 +150,7 @@ uint64_t inode; // printf("pid: %d\n",ki->ki_pid); -#if defined(__linux__) +#if defined(__linux__) || defined(__NetBSD__) char path[100]; struct stat st; snprintf(path,100,"/proc/%lld/cwd",(long long int)pid); @@ -251,7 +251,7 @@ } void sinodes_all_pids(void) { -#if defined(__linux__) +#if defined(__linux__) || defined(__NetBSD__) DIR *dd; struct dirent *de,*destorage; const char *np; -- Elections cannot be allowed to change anything. --Dr. Wolfgang Schäuble |