PERFORCE change 195719 for review
Ilya Putsikau
ilya at FreeBSD.org
Mon Jul 4 16:28:44 UTC 2011
http://p4web.freebsd.org/@@195719?ac=10
Change 195719 by ilya at ilya_triton2011 on 2011/07/04 16:27:47
Add user space daemon reply timeout
Affected files ...
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse.h#12 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_ipc.c#9 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_ipc.h#10 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vfsops.c#18 edit
Differences ...
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse.h#12 (text+ko) ====
@@ -6,6 +6,11 @@
#include "fuse4bsd.h"
#include "fuse_kernel.h"
+#define FUSE_DEFAULT_DAEMON_TIMEOUT 60 /* s */
+#define FUSE_MIN_DAEMON_TIMEOUT 0 /* s */
+#define FUSE_MAX_DAEMON_TIMEOUT 600 /* s */
+
+
/* Mapping versions to features */
#define FUSE_KERNELABI_GEQ(maj, min) \
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_ipc.c#9 (text+ko) ====
@@ -195,6 +195,7 @@
fticket_wait_answer(struct fuse_ticket *ftick)
{
int err = 0;
+ struct fuse_data *data;
debug_printf("ftick=%p\n", ftick);
fuse_lck_mtx_lock(ftick->tk_aw_mtx);
@@ -203,13 +204,25 @@
goto out;
}
- if (fdata_get_dead(ftick->tk_data)) {
+ data = ftick->tk_data;
+
+ if (fdata_get_dead(data)) {
err = ENOTCONN;
fticket_set_answered(ftick);
goto out;
}
- err = msleep(ftick, &ftick->tk_aw_mtx, PCATCH, "fu_ans", 0);
+ err = msleep(ftick, &ftick->tk_aw_mtx, PCATCH, "fu_ans",
+ data->daemon_timeout * hz);
+ if (err == EAGAIN) { /* same as EWOULDBLOCK */
+#ifdef XXXIP /* die conditionally */
+ if (!fdata_get_dead(data)) {
+ fdata_set_dead(data);
+ }
+#endif
+ err = ETIMEDOUT;
+ fticket_set_answered(ftick);
+ }
out:
fuse_lck_mtx_unlock(ftick->tk_aw_mtx);
@@ -301,6 +314,7 @@
data->ticketer = 0;
data->freeticket_counter = 0;
data->daemoncred = crhold(cred);
+ data->daemon_timeout = FUSE_DEFAULT_DAEMON_TIMEOUT;
#ifdef FUSE_EXPLICIT_RENAME_LOCK
sx_init(&data->rename_lock, "fuse rename lock");
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_ipc.h#10 (text+ko) ====
@@ -146,6 +146,8 @@
char volname[MAXPATHLEN];
struct selinfo ks_rsel;
+
+ int daemon_timeout;
};
#define FSESS_DEAD 0x0001 // session is to be closed
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vfsops.c#18 (text+ko) ====
@@ -85,6 +85,7 @@
int __mntopts = 0;
int max_read_set = 0;
uint32_t max_read = ~0;
+ int daemon_timeout;
size_t len;
@@ -208,6 +209,13 @@
if (vfs_scanopt(opts, "max_read=", "%u", &max_read) == 1)
max_read_set = 1;
+ if (vfs_scanopt(opts, "timeout=", "%u", &daemon_timeout) == 1) {
+ if (daemon_timeout < FUSE_MIN_DAEMON_TIMEOUT)
+ daemon_timeout = FUSE_MIN_DAEMON_TIMEOUT;
+ else if (daemon_timeout > FUSE_MAX_DAEMON_TIMEOUT)
+ daemon_timeout = FUSE_MAX_DAEMON_TIMEOUT;
+ data->daemon_timeout = daemon_timeout;
+ }
subtype = vfs_getopts(opts, "subtype=", &err);
err = 0;
More information about the p4-projects
mailing list