diff options
author | Jean-Pierre André <jpandre@users.sourceforge.net> | 2012-08-22 10:00:21 +0200 |
---|---|---|
committer | Jean-Pierre André <jpandre@users.sourceforge.net> | 2012-08-22 10:00:21 +0200 |
commit | cd8b716a67d07a4278f1d8305ab0493d1873d885 (patch) | |
tree | dd794e1dbad03eaadb84f2276812c880dabdd36c /kernel/fuse_dev.c | |
parent | 5c5174322bd32ffc52fb1aa65964290bace05f7d (diff) | |
download | illumos-fusefs-cd8b716a67d07a4278f1d8305ab0493d1873d885.tar.gz |
Deleted sent messages when no reply is expected
Diffstat (limited to 'kernel/fuse_dev.c')
-rw-r--r-- | kernel/fuse_dev.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/kernel/fuse_dev.c b/kernel/fuse_dev.c index 50f29af..6f38d9f 100644 --- a/kernel/fuse_dev.c +++ b/kernel/fuse_dev.c @@ -21,6 +21,8 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Portions Copyright 2012 Jean-Pierre Andre */ /* @@ -369,6 +371,7 @@ fuse_dev_write(dev_t dev, struct uio *uiop, cred_t *cred_p) struct fuse_out_header *outh; fuse_session_t *se_p; fuse_msg_node_t *msg_p = NULL; + fuse_msg_node_t *msg_next; minor_t ndx = getminor(dev); struct fuse_iov *iovbuf; @@ -414,8 +417,7 @@ fuse_dev_write(dev_t dev, struct uio *uiop, cred_t *cred_p) /* Reset error before starting the search */ err = DDI_FAILURE; - for (msg_p = list_head(&(se_p->msg_list)); msg_p; - msg_p = list_next(&(se_p->msg_list), msg_p)) { + for (msg_p = list_head(&(se_p->msg_list)); msg_p; ) { if (msg_p->fmn_unique == outh->unique) { if (msg_p->fmn_state == FUSE_MSG_STATE_READ) { msg_p->fmn_state = FUSE_MSG_STATE_WRITE; @@ -430,6 +432,24 @@ fuse_dev_write(dev_t dev, struct uio *uiop, cred_t *cred_p) FUSE_SESSION_MUTEX_UNLOCK(se_p); goto cleanup; } + msg_p = list_next(&(se_p->msg_list), msg_p); + } else { + msg_next = list_next(&(se_p->msg_list), msg_p); + /* + * if no callback handler is registered, and no + * reply is expected, it is our responsibility + * to free up obsolete message nodes. + */ + if (!msg_p->frd_on_request_complete + && msg_p->fmn_noreply) { + if (msg_p->fmn_unique < se_p->max_unique) { + list_remove(&(se_p->msg_list), msg_p); + fuse_free_msg(msg_p); + } + if (outh->unique > se_p->max_unique) + se_p->max_unique = outh->unique; + } + msg_p = msg_next; } } FUSE_SESSION_MUTEX_UNLOCK(se_p); |