Page MenuHomeFreeBSD

D27770.diff
No OneTemporary

D27770.diff

diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c
--- a/sys/fs/fuse/fuse_device.c
+++ b/sys/fs/fuse/fuse_device.c
@@ -287,9 +287,8 @@
int err;
struct fuse_data *data;
struct fuse_ticket *tick;
- void *buf[] = {NULL, NULL, NULL};
- int buflen[3];
- int i;
+ void *buf;
+ int buflen;
SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read");
@@ -352,46 +351,27 @@
SDT_PROBE2(fusefs, , device, trace, 1,
"fuse device read message successfully");
- KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0,
- ("non-null buf pointer with positive size"));
-
- switch (tick->tk_ms_type) {
- case FT_M_FIOV:
- buf[0] = tick->tk_ms_fiov.base;
- buflen[0] = tick->tk_ms_fiov.len;
- break;
- case FT_M_BUF:
- buf[0] = tick->tk_ms_fiov.base;
- buflen[0] = tick->tk_ms_fiov.len;
- buf[1] = tick->tk_ms_bufdata;
- buflen[1] = tick->tk_ms_bufsize;
- break;
- default:
- panic("unknown message type for fuse_ticket %p", tick);
- }
+ buf = tick->tk_ms_fiov.base;
+ buflen = tick->tk_ms_fiov.len;
- for (i = 0; buf[i]; i++) {
- /*
- * Why not ban mercilessly stupid daemons who can't keep up
- * with us? (There is no much use of a partial read here...)
- */
- /*
- * XXX note that in such cases Linux FUSE throws EIO at the
- * syscall invoker and stands back to the message queue. The
- * rationale should be made clear (and possibly adopt that
- * behaviour). Keeping the current scheme at least makes
- * fallacy as loud as possible...
- */
- if (uio->uio_resid < buflen[i]) {
- fdata_set_dead(data);
- SDT_PROBE2(fusefs, , device, trace, 2,
- "daemon is stupid, kick it off...");
- err = ENODEV;
- break;
- }
- err = uiomove(buf[i], buflen[i], uio);
- if (err)
- break;
+ /*
+ * Why not ban mercilessly stupid daemons who can't keep up
+ * with us? (There is no much use of a partial read here...)
+ */
+ /*
+ * XXX note that in such cases Linux FUSE throws EIO at the
+ * syscall invoker and stands back to the message queue. The
+ * rationale should be made clear (and possibly adopt that
+ * behaviour). Keeping the current scheme at least makes
+ * fallacy as loud as possible...
+ */
+ if (uio->uio_resid < buflen) {
+ fdata_set_dead(data);
+ SDT_PROBE2(fusefs, , device, trace, 2,
+ "daemon is stupid, kick it off...");
+ err = ENODEV;
+ } else {
+ err = uiomove(buf, buflen, uio);
}
FUSE_ASSERT_MS_DONE(tick);
diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h
--- a/sys/fs/fuse/fuse_ipc.h
+++ b/sys/fs/fuse/fuse_ipc.h
@@ -123,17 +123,10 @@
/* fields for initiating an upgoing message */
struct fuse_iov tk_ms_fiov;
- void *tk_ms_bufdata;
- size_t tk_ms_bufsize;
- enum { FT_M_FIOV, FT_M_BUF } tk_ms_type;
STAILQ_ENTRY(fuse_ticket) tk_ms_link;
/* fields for handling answers coming from userspace */
struct fuse_iov tk_aw_fiov;
- void *tk_aw_bufdata;
- size_t tk_aw_bufsize;
- enum { FT_A_FIOV, FT_A_BUF } tk_aw_type;
-
struct fuse_out_header tk_aw_ohead;
int tk_aw_errno;
struct mtx tk_aw_mtx;
diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c
--- a/sys/fs/fuse/fuse_ipc.c
+++ b/sys/fs/fuse/fuse_ipc.c
@@ -356,11 +356,9 @@
bzero(ftick, sizeof(struct fuse_ticket));
fiov_init(&ftick->tk_ms_fiov, sizeof(struct fuse_in_header));
- ftick->tk_ms_type = FT_M_FIOV;
mtx_init(&ftick->tk_aw_mtx, "fuse answer delivery mutex", NULL, MTX_DEF);
fiov_init(&ftick->tk_aw_fiov, 0);
- ftick->tk_aw_type = FT_A_FIOV;
return 0;
}
@@ -395,18 +393,11 @@
FUSE_ASSERT_AW_DONE(ftick);
fiov_refresh(&ftick->tk_ms_fiov);
- ftick->tk_ms_bufdata = NULL;
- ftick->tk_ms_bufsize = 0;
- ftick->tk_ms_type = FT_M_FIOV;
bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header));
fiov_refresh(&ftick->tk_aw_fiov);
ftick->tk_aw_errno = 0;
- ftick->tk_aw_bufdata = NULL;
- ftick->tk_aw_bufsize = 0;
- ftick->tk_aw_type = FT_A_FIOV;
-
ftick->tk_flag = 0;
}
@@ -417,17 +408,9 @@
FUSE_ASSERT_MS_DONE(ftick);
FUSE_ASSERT_AW_DONE(ftick);
- ftick->tk_ms_bufdata = NULL;
- ftick->tk_ms_bufsize = 0;
- ftick->tk_ms_type = FT_M_FIOV;
-
bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header));
ftick->tk_aw_errno = 0;
- ftick->tk_aw_bufdata = NULL;
- ftick->tk_aw_bufsize = 0;
- ftick->tk_aw_type = FT_A_FIOV;
-
ftick->tk_flag = 0;
}
@@ -546,20 +529,8 @@
size_t len = uio_resid(uio);
if (len) {
- switch (ftick->tk_aw_type) {
- case FT_A_FIOV:
- fiov_adjust(fticket_resp(ftick), len);
- err = uiomove(fticket_resp(ftick)->base, len, uio);
- break;
-
- case FT_A_BUF:
- ftick->tk_aw_bufsize = len;
- err = uiomove(ftick->tk_aw_bufdata, len, uio);
- break;
-
- default:
- panic("FUSE: unknown answer type for ticket %p", ftick);
- }
+ fiov_adjust(fticket_resp(ftick), len);
+ err = uiomove(fticket_resp(ftick)->base, len, uio);
}
return err;
}

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 5, 9:13 PM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13677892
Default Alt Text
D27770.diff (4 KB)

Event Timeline