Skip to content

Commit 1c8bc61

Browse files
committed
fix logic error breaking sqlite
1 parent c669d9c commit 1c8bc61

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/operations.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,14 @@ static void do_passthrough_open(fuse_req_t req, fuse_ino_t ino, int fd, fuse_fil
532532
Inode &inode = get_inode(ino);
533533
if (inode.backing_id) {
534534
fi->backing_id = inode.backing_id;
535+
debug_print("reusing existing backing_id for inode {}", ino);
535536
} else if (is_write) {
536537
debug_print("not handling fuse_passthrough due to writing.");
537538
} else if (!(inode.backing_id = fuse_passthrough_open(req, fd))) {
538539
debug_print("fuse_passthrough_open failed for inode {}, disabling rw passthrough.", ino);
539540
} else {
540541
fi->backing_id = inode.backing_id;
542+
debug_print("assigned new backing_id for inode {}", ino);
541543
}
542544
fi->keep_cache = false;
543545
}
@@ -556,6 +558,9 @@ static void sfs_create(fuse_req_t req, fuse_ino_t parent, const char *name, mode
556558
fuse_file_info *fi) {
557559
Inode &inode_p = get_inode(parent);
558560

561+
debug_print("sfs_create: parent ino {}, name '{}', mode {:o}, flags {:o}", parent, name, mode,
562+
fi->flags);
563+
559564
int fd = openat(inode_p.fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW, mode);
560565
if (fd == -1) {
561566
fuse_reply_err(req, errno);
@@ -639,17 +644,13 @@ static void sfs_fsync(fuse_req_t req, fuse_ino_t ino, int datasync, fuse_file_in
639644

640645
static void sfs_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, fuse_file_info *fi) {
641646
(void)ino;
642-
if (fs.passthrough && !fs.direct_io) {
643-
fuse_reply_err(req, EIO);
644-
return;
645-
}
646647

647648
fuse_bufvec buf = FUSE_BUFVEC_INIT(size);
648649
char *payload = nullptr;
649650
size_t payload_size = 0;
650651
int res = fuse_req_get_payload(req, &payload, &payload_size, NULL);
651652

652-
if (res == 0) {
653+
if (res == 0 && payload_size >= size) {
653654
buf.buf[0].mem = payload;
654655
buf.buf[0].size = payload_size;
655656
res = pread(fi->fh, payload, size, off);

0 commit comments

Comments
 (0)