From: Fotis Xenakis <[email protected]> Committer: Waldemar Kozaczuk <[email protected]> Branch: master
virtio-fs: use FUSE_OPENDIR and FUSE_RELEASEDIR When the file being open()ed or close()d is a directory, use FUSE_OPENDIR and FUSE_RELEASEDIR instead of FUSE_OPEN and FUSE_RELEASE respectively. Signed-off-by: Fotis Xenakis <[email protected]> Message-Id: <am0pr03mb62929c121686c738e09f2d94a6...@am0pr03mb6292.eurprd03.prod.outlook.com> --- diff --git a/fs/virtiofs/virtiofs_vnops.cc b/fs/virtiofs/virtiofs_vnops.cc --- a/fs/virtiofs/virtiofs_vnops.cc +++ b/fs/virtiofs/virtiofs_vnops.cc @@ -112,7 +112,8 @@ static int virtiofs_open(struct file* fp) auto* m_data = static_cast<virtiofs_mount_data*>(vnode->v_mount->m_data); auto* drv = m_data->drv; - auto error = fuse_req_send_and_receive_reply(drv, FUSE_OPEN, + auto operation = S_ISDIR(inode->attr.mode) ? FUSE_OPENDIR : FUSE_OPEN; + auto error = fuse_req_send_and_receive_reply(drv, operation, inode->nodeid, in_args.get(), sizeof(*in_args), out_args.get(), sizeof(*out_args)).second; if (error) { @@ -148,7 +149,8 @@ static int virtiofs_close(struct vnode* vnode, struct file* fp) auto* m_data = static_cast<virtiofs_mount_data*>(vnode->v_mount->m_data); auto* drv = m_data->drv; - auto error = fuse_req_send_and_receive_reply(drv, FUSE_RELEASE, + auto operation = S_ISDIR(inode->attr.mode) ? FUSE_RELEASEDIR : FUSE_RELEASE; + auto error = fuse_req_send_and_receive_reply(drv, operation, inode->nodeid, in_args.get(), sizeof(*in_args), nullptr, 0).second; if (error) { kprintf("[virtiofs] inode %lld, close failed\n", inode->nodeid); -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000b8a74d05aafd169c%40google.com.
