diff options
| -rw-r--r-- | src/src/fuseconnector.cpp | 1 | ||||
| -rw-r--r-- | src/src/vfs/mo2filesystem.cpp | 8 | ||||
| -rw-r--r-- | src/src/vfs/mo2filesystem.h | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/src/fuseconnector.cpp b/src/src/fuseconnector.cpp index c5b5718..3b3c1ba 100644 --- a/src/src/fuseconnector.cpp +++ b/src/src/fuseconnector.cpp @@ -578,6 +578,7 @@ bool FuseConnector::mount( m_backingFd = -1; throw FuseConnectorException(QObject::tr("Failed to create FUSE session")); } + m_context->session = m_session; if (fuse_session_mount(m_session, m_mountPoint.c_str()) != 0) { fuse_session_destroy(m_session); diff --git a/src/src/vfs/mo2filesystem.cpp b/src/src/vfs/mo2filesystem.cpp index 9d2eb14..5fa170e 100644 --- a/src/src/vfs/mo2filesystem.cpp +++ b/src/src/vfs/mo2filesystem.cpp @@ -1900,7 +1900,7 @@ void mo2_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) openSize, openMtime); // Flush stale kernel page cache so the next read sees the truncated // content, not the pre-truncation data cached from a prior open. - fuse_lowlevel_notify_inval_inode(fuse_req_session(req), ino, 0, 0); + fuse_lowlevel_notify_inval_inode(ctx->session, ino, 0, 0); } } else { // Mod file disappeared — fall through to normal handling @@ -1920,7 +1920,7 @@ void mo2_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) openMtime = std::chrono::system_clock::now(); updateFileNodeKnown(ctx, path, realPath, originForPath(ctx, realPath), openSize, openMtime); - fuse_lowlevel_notify_inval_inode(fuse_req_session(req), ino, 0, 0); + fuse_lowlevel_notify_inval_inode(ctx->session, ino, 0, 0); } } else if (fd < 0 && truncateOnOpen) { try { @@ -1943,7 +1943,7 @@ void mo2_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) // The file's backing path changed from mod/base-game to staging. // Flush the kernel page cache so subsequent reads go through FUSE // and see the staging content, not the pre-COW cached data. - fuse_lowlevel_notify_inval_inode(fuse_req_session(req), ino, 0, 0); + fuse_lowlevel_notify_inval_inode(ctx->session, ino, 0, 0); } } catch (...) { fuse_reply_err(req, EIO); @@ -2152,7 +2152,7 @@ void mo2_write(fuse_req_t req, fuse_ino_t ino, const char* buf, size_t size, // mo2_open — without it, repeated WritePrivateProfileString calls on the // same INI file each read the old mod-file content and only the last // write survives. - fuse_lowlevel_notify_inval_inode(fuse_req_session(req), ino, 0, 0); + fuse_lowlevel_notify_inval_inode(ctx->session, ino, 0, 0); } catch (...) { fuse_reply_err(req, EIO); return; diff --git a/src/src/vfs/mo2filesystem.h b/src/src/vfs/mo2filesystem.h index f8d5330..e717825 100644 --- a/src/src/vfs/mo2filesystem.h +++ b/src/src/vfs/mo2filesystem.h @@ -173,6 +173,10 @@ struct Mo2FsContext uid_t uid = 0; gid_t gid = 0; + // Set once after fuse_session_new(); used by notify_inval_inode calls to + // flush stale kernel page cache without needing fuse_req_session(req). + struct fuse_session* session = nullptr; + }; void mo2_init(void* userdata, struct fuse_conn_info* conn); |
