Commit be90837
Fix batch forget can't handle too large msg
error: cannot process fuse message: Value too large for defined data type
By default, when fuse sever reads the batch forget request, the bufsize given
is MAX_BUFFER_SIZE + BUFFER_HEADER_SIZE, and the fuse kernel will
fill this buffer as much as possible, so the size of the data that batch forget
can fill should be the total buffer size - fuse header - batch forget header
Here's the code for the fuse kernel to fill the batch forget request.
```
struct fuse_batch_forget_in arg = { .count = 0 };
struct fuse_in_header ih = {
.opcode = FUSE_BATCH_FORGET,
.unique = fuse_get_unique(fiq),
.len = sizeof(ih) + sizeof(arg),
};
if (nbytes < ih.len) {
spin_unlock(&fiq->lock);
return -EINVAL;
}
max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one);
head = fuse_dequeue_forget(fiq, max_forgets, &count);
spin_unlock(&fiq->lock);
arg.count = count;
ih.len += count * sizeof(struct fuse_forget_one);
```
so fuse_batch_forget_in.count * sizeof(struct fuse_forget_one)
should less than or equal to bufsize - sizeof(fuse_in_header) - sizeof(fuse_batch_forget_in)
Signed-off-by: zyfjeff <[email protected]>1 parent d925e47 commit be90837
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1107 | 1107 | | |
1108 | 1108 | | |
1109 | 1109 | | |
1110 | | - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1111 | 1115 | | |
1112 | 1116 | | |
1113 | 1117 | | |
| |||
0 commit comments