From: Miklos Szeredi Date: Thu, 16 Feb 2006 16:59:39 +0000 (+0000) Subject: fix X-Git-Tag: fuse_2_6_0_pre1~3 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6e806e964d722e7e0f7c029b50d69cf877c193ee;p=qemu-gpiodev%2Flibfuse.git fix --- diff --git a/ChangeLog b/ChangeLog index f3c3e89..c447832 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * Fix rare race betweeen abort and release caused by failed iget() in fuse_create_open(). + * Add 'ac_attr_timeout' option e.g. for filesystems which do their + own attribute caching. + 2006-02-15 Miklos Szeredi * Work around FreeBSD runtime linker "feature" which binds an old diff --git a/lib/fuse.c b/lib/fuse.c index 68ff59f..ea17a3d 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -39,6 +39,8 @@ struct fuse_config { double entry_timeout; double negative_timeout; double attr_timeout; + double ac_attr_timeout; + int ac_attr_timeout_set; int debug; int hard_remove; int use_ino; @@ -1141,7 +1143,7 @@ static void open_auto_cache(struct fuse *f, fuse_ino_t ino, const char *path, struct timespec now; curr_time(&now); - if (diff_timespec(&now, &node->stat_updated) > f->conf.attr_timeout) { + if (diff_timespec(&now, &node->stat_updated) > f->conf.ac_attr_timeout) { struct stat stbuf; int err; @@ -1936,6 +1938,8 @@ static const struct fuse_opt fuse_lib_opts[] = { FUSE_LIB_OPT("gid=%d", gid, 0), FUSE_LIB_OPT("entry_timeout=%lf", entry_timeout, 0), FUSE_LIB_OPT("attr_timeout=%lf", attr_timeout, 0), + FUSE_LIB_OPT("ac_attr_timeout=%lf", ac_attr_timeout, 0), + FUSE_LIB_OPT("ac_attr_timeout=", ac_attr_timeout_set, 1), FUSE_LIB_OPT("negative_timeout=%lf", negative_timeout, 0), FUSE_OPT_END }; @@ -1954,8 +1958,9 @@ static void fuse_lib_help(void) " -o gid=N set file group\n" " -o entry_timeout=T cache timeout for names (1.0s)\n" " -o negative_timeout=T cache timeout for deleted names (0.0s)\n" - " -o attr_timeout=T cache timeout for attributes (1.0s)\n" - "\n"); +" -o attr_timeout=T cache timeout for attributes (1.0s)\n" +" -o ac_attr_timeout=T auto cache timeout for attributes (attr_timeout)\n" +"\n"); } static int fuse_lib_opt_proc(void *data, const char *arg, int key, @@ -2002,6 +2007,9 @@ struct fuse *fuse_new_common(int fd, struct fuse_args *args, if (fuse_opt_parse(args, &f->conf, fuse_lib_opts, fuse_lib_opt_proc) == -1) goto out_free; + if (!f->conf.ac_attr_timeout_set) + f->conf.ac_attr_timeout = f->conf.attr_timeout; + #ifdef __FreeBSD__ /* * In FreeBSD, we always use these settings as inode numbers are needed to