From be4c74ead31246bd9b332f83a9e298969385fc4e Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Thu, 21 Jun 2012 21:09:41 +0200 Subject: [PATCH] nfs4: close*() should wake all blocked operations --- .../kernel/file_systems/nfs4/Cookie.cpp | 86 +++++++++++++++++++ src/add-ons/kernel/file_systems/nfs4/Cookie.h | 61 +++++++++++++ .../kernel/file_systems/nfs4/Inode.cpp | 34 ++++---- src/add-ons/kernel/file_systems/nfs4/Inode.h | 33 +++---- src/add-ons/kernel/file_systems/nfs4/Jamfile | 1 + .../kernel/file_systems/nfs4/RPCServer.cpp | 17 ++++ .../kernel/file_systems/nfs4/RPCServer.h | 3 + .../file_systems/nfs4/ReplyInterpreter.cpp | 8 +- .../file_systems/nfs4/ReplyInterpreter.h | 4 +- .../kernel/file_systems/nfs4/Request.cpp | 59 ++++++++++--- .../kernel/file_systems/nfs4/Request.h | 8 +- .../file_systems/nfs4/RequestBuilder.cpp | 8 +- .../kernel/file_systems/nfs4/RequestBuilder.h | 5 +- .../file_systems/nfs4/kernel_interface.cpp | 21 +++-- 14 files changed, 279 insertions(+), 69 deletions(-) create mode 100644 src/add-ons/kernel/file_systems/nfs4/Cookie.cpp create mode 100644 src/add-ons/kernel/file_systems/nfs4/Cookie.h diff --git a/src/add-ons/kernel/file_systems/nfs4/Cookie.cpp b/src/add-ons/kernel/file_systems/nfs4/Cookie.cpp new file mode 100644 index 0000000000..e2cc986c43 --- /dev/null +++ b/src/add-ons/kernel/file_systems/nfs4/Cookie.cpp @@ -0,0 +1,86 @@ +/* + * Copyright 2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Paweł Dziepak, pdziepak@quarnos.org + */ + + +#include "Cookie.h" + +#include "Inode.h" +#include "Request.h" + + +vint64 OpenFileCookie::fLastOwnerId = 0; + + +Cookie::Cookie() + : + fRequests(NULL) +{ + mutex_init(&fRequestLock, NULL); +} + + +Cookie::~Cookie() +{ + mutex_destroy(&fRequestLock); +} + + +status_t +Cookie::RegisterRequest(RPC::Request* req) +{ + mutex_lock(&fRequestLock); + RequestEntry* ent = new RequestEntry; + if (ent == NULL) { + mutex_unlock(&fRequestLock); + return B_NO_MEMORY; + } + + ent->fRequest = req; + ent->fNext = fRequests; + fRequests = ent; + mutex_unlock(&fRequestLock); + return B_OK; +} + + +status_t +Cookie::UnregisterRequest(RPC::Request* req) +{ + mutex_lock(&fRequestLock); + RequestEntry* ent = fRequests; + RequestEntry* prev = NULL; + while (ent != NULL) { + if (ent->fRequest == req) { + if (prev == NULL) + fRequests = ent->fNext; + else + prev->fNext = ent->fNext; + delete ent; + } + + prev = ent; + ent = ent->fNext; + } + mutex_unlock(&fRequestLock); + return B_OK; +} + + +status_t +Cookie::CancelAll() +{ + mutex_lock(&fRequestLock); + RequestEntry* ent = fRequests; + while (ent != NULL) { + fInode->FileSystem()->Server()->WakeCall(ent->fRequest); + ent = ent->fNext; + } + mutex_unlock(&fRequestLock); + return B_OK; +} + diff --git a/src/add-ons/kernel/file_systems/nfs4/Cookie.h b/src/add-ons/kernel/file_systems/nfs4/Cookie.h new file mode 100644 index 0000000000..13671baee0 --- /dev/null +++ b/src/add-ons/kernel/file_systems/nfs4/Cookie.h @@ -0,0 +1,61 @@ +/* + * Copyright 2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Paweł Dziepak, pdziepak@quarnos.org + */ +#ifndef COOKIE_H +#define COOKIE_H + + +#include + +#include "Filesystem.h" + +class Inode; + +struct Cookie { + struct RequestEntry { + RPC::Request* fRequest; + RequestEntry* fNext; + }; + + Inode* fInode; + RequestEntry* fRequests; + mutex fRequestLock; + + Cookie(); + virtual ~Cookie(); + + status_t RegisterRequest(RPC::Request* req); + status_t UnregisterRequest(RPC::Request* req); + status_t CancelAll(); +}; + +struct OpenFileCookie : public Cookie { + uint64 fClientId; + + uint32 fMode; + + Filehandle fHandle; + uint32 fStateId[3]; + uint32 fStateSeq; + + uint32 fSequence; + + uint64 fOwnerId; + static vint64 fLastOwnerId; + + OpenFileCookie* fNext; + OpenFileCookie* fPrev; +}; + +struct OpenDirCookie : public Cookie { + uint64 fCookie; + uint64 fCookieVerf; +}; + + +#endif // COOKIE_H + diff --git a/src/add-ons/kernel/file_systems/nfs4/Inode.cpp b/src/add-ons/kernel/file_systems/nfs4/Inode.cpp index 9ce8efcc94..d4e9e20bb4 100644 --- a/src/add-ons/kernel/file_systems/nfs4/Inode.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/Inode.cpp @@ -15,9 +15,6 @@ #include "Request.h" -vint64 OpenFileCookie::fLastOwnerId = 0; - - Inode::Inode() { } @@ -447,6 +444,7 @@ Inode::Open(int mode, OpenFileCookie* cookie) bool confirm; status_t result; + cookie->fInode = this; cookie->fHandle = fHandle; cookie->fMode = mode; cookie->fSequence = 0; @@ -610,7 +608,7 @@ Inode::Read(OpenFileCookie* cookie, off_t pos, void* buffer, size_t* _length) req.Read(cookie->fStateId, cookie->fStateSeq, pos + size, *_length - size); - status_t result = request.Send(); + status_t result = request.Send(cookie); if (result != B_OK) return result; @@ -664,7 +662,7 @@ Inode::Read(OpenFileCookie* cookie, off_t pos, void* buffer, size_t* _length) status_t -Inode::OpenDir(uint64* cookie) +Inode::OpenDir(OpenDirCookie* cookie) { if (fType != NF4DIR) return B_NOT_A_DIRECTORY; @@ -707,8 +705,9 @@ Inode::OpenDir(uint64* cookie) if (allowed & ACCESS4_READ != ACCESS4_READ) return B_PERMISSION_DENIED; - cookie[0] = 0; - cookie[1] = 2; + cookie->fInode = this; + cookie->fCookie = 0; + cookie->fCookieVerf = 2; return B_OK; } while (true); @@ -716,7 +715,7 @@ Inode::OpenDir(uint64* cookie) status_t -Inode::_ReadDirOnce(DirEntry** dirents, uint32* count, uint64* cookie, +Inode::_ReadDirOnce(DirEntry** dirents, uint32* count, OpenDirCookie* cookie, bool* eof) { do { @@ -727,9 +726,10 @@ Inode::_ReadDirOnce(DirEntry** dirents, uint32* count, uint64* cookie, req.PutFH(fHandle); Attribute attr[] = { FATTR4_FSID, FATTR4_FILEID }; - req.ReadDir(*count, cookie, attr, sizeof(attr) / sizeof(Attribute)); + req.ReadDir(*count, cookie->fCookie, cookie->fCookieVerf, attr, + sizeof(attr) / sizeof(Attribute)); - status_t result = request.Send(); + status_t result = request.Send(cookie); if (result != B_OK) return result; @@ -751,7 +751,8 @@ Inode::_ReadDirOnce(DirEntry** dirents, uint32* count, uint64* cookie, if (result != B_OK) return result; - return reply.ReadDir(cookie, dirents, count, eof); + return reply.ReadDir(&cookie->fCookie, &cookie->fCookieVerf, dirents, + count, eof); } while (true); } @@ -846,7 +847,8 @@ Inode::_ReadDirUp(struct dirent* de, uint32 pos, uint32 size) // When directories are cached client should store inode numbers it assigned // to directroy entries and use them consequently. status_t -Inode::ReadDir(void* _buffer, uint32 size, uint32* _count, uint64* cookie) +Inode::ReadDir(void* _buffer, uint32 size, uint32* _count, + OpenDirCookie* cookie) { uint32 count = 0; uint32 pos = 0; @@ -855,17 +857,17 @@ Inode::ReadDir(void* _buffer, uint32 size, uint32* _count, uint64* cookie) char* buffer = reinterpret_cast(_buffer); - if (cookie[0] == 0 && cookie[1] == 2 && count < *_count) { + if (cookie->fCookie == 0 && cookie->fCookieVerf == 2 && count < *_count) { struct dirent* de = reinterpret_cast(buffer + pos); _FillDirEntry(de, fFileId, ".", pos, size); pos += de->d_reclen; count++; - cookie[1]--; + cookie->fCookieVerf--; } - if (cookie[0] == 0 && cookie[1] == 1 && count < *_count) { + if (cookie->fCookie == 0 && cookie->fCookieVerf == 1 && count < *_count) { struct dirent* de = reinterpret_cast(buffer + pos); if (strcmp(fName, "/")) @@ -875,7 +877,7 @@ Inode::ReadDir(void* _buffer, uint32 size, uint32* _count, uint64* cookie) pos += de->d_reclen; count++; - cookie[1]--; + cookie->fCookieVerf--; } bool overflow = false; diff --git a/src/add-ons/kernel/file_systems/nfs4/Inode.h b/src/add-ons/kernel/file_systems/nfs4/Inode.h index d60873a98a..c1e7464426 100644 --- a/src/add-ons/kernel/file_systems/nfs4/Inode.h +++ b/src/add-ons/kernel/file_systems/nfs4/Inode.h @@ -13,29 +13,12 @@ #include +#include "Cookie.h" #include "Filesystem.h" #include "NFS4Defs.h" #include "ReplyInterpreter.h" -struct OpenFileCookie { - uint64 fClientId; - - uint32 fMode; - - Filehandle fHandle; - uint32 fStateId[3]; - uint32 fStateSeq; - - uint32 fSequence; - - uint64 fOwnerId; - static vint64 fLastOwnerId; - - OpenFileCookie* fNext; - OpenFileCookie* fPrev; -}; - class Inode { public: static status_t CreateInode(Filesystem* fs, const FileInfo& fi, @@ -45,6 +28,7 @@ public: inline ino_t ID() const; inline mode_t Type() const; inline const char* Name() const; + inline Filesystem* FileSystem() const; status_t LookUp(const char* name, ino_t* id); status_t ReadLink(void* buffer, size_t* length); @@ -56,9 +40,9 @@ public: status_t Read(OpenFileCookie* cookie, off_t pos, void* buffer, size_t* length); - status_t OpenDir(uint64* cookie); + status_t OpenDir(OpenDirCookie* cookie); status_t ReadDir(void* buffer, uint32 size, - uint32* count, uint64* cookie); + uint32* count, OpenDirCookie* cookie); private: Inode(); @@ -66,7 +50,7 @@ private: status_t _LookUpFilehandle(); status_t _ReadDirOnce(DirEntry** dirents, uint32* count, - uint64* cookie, bool* eof); + OpenDirCookie* cookie, bool* eof); status_t _FillDirEntry(struct dirent* de, ino_t id, const char* name, uint32 pos, uint32 size); status_t _ReadDirUp(struct dirent* de, uint32 pos, @@ -119,5 +103,12 @@ Inode::Name() const } +inline Filesystem* +Inode::FileSystem() const +{ + return fFilesystem; +} + + #endif // INODE_H diff --git a/src/add-ons/kernel/file_systems/nfs4/Jamfile b/src/add-ons/kernel/file_systems/nfs4/Jamfile index a5ac6260ff..933b1e0112 100644 --- a/src/add-ons/kernel/file_systems/nfs4/Jamfile +++ b/src/add-ons/kernel/file_systems/nfs4/Jamfile @@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel file_systems nfs4 ; UsePrivateHeaders kernel ; KernelAddon nfs4 : + Cookie.cpp Connection.cpp Filesystem.cpp Inode.cpp diff --git a/src/add-ons/kernel/file_systems/nfs4/RPCServer.cpp b/src/add-ons/kernel/file_systems/nfs4/RPCServer.cpp index 8edb3d84d1..e4556d744d 100644 --- a/src/add-ons/kernel/file_systems/nfs4/RPCServer.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/RPCServer.cpp @@ -155,6 +155,7 @@ Server::SendCallAsync(Call* call, Reply** reply, Request** request) req->fReply = reply; req->fEvent.Init(&req->fEvent, NULL); req->fDone = false; + req->fError = B_OK; req->fNext = NULL; fRequests.AddRequest(req); @@ -185,6 +186,22 @@ Server::ResendCallAsync(Call* call, Request* req) } +status_t +Server::WakeCall(Request* request) +{ + Request* req = fRequests.FindRequest(request->fXID); + if (req == NULL) + return B_OK; + + request->fError = B_FILE_ERROR; + *request->fReply = NULL; + request->fDone = true; + request->fEvent.NotifyAll(); + + return B_OK; +} + + status_t Server::Repair() { diff --git a/src/add-ons/kernel/file_systems/nfs4/RPCServer.h b/src/add-ons/kernel/file_systems/nfs4/RPCServer.h index c45765e63e..4d622d9905 100644 --- a/src/add-ons/kernel/file_systems/nfs4/RPCServer.h +++ b/src/add-ons/kernel/file_systems/nfs4/RPCServer.h @@ -22,8 +22,10 @@ namespace RPC { struct Request { uint32 fXID; ConditionVariable fEvent; + bool fDone; Reply** fReply; + status_t fError; Request* fNext; }; @@ -62,6 +64,7 @@ public: inline status_t WaitCall(Request* request, bigtime_t time = kWaitTime); inline status_t CancelCall(Request* request); + status_t WakeCall(Request* request); status_t Repair(); diff --git a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp index 01129a5842..69ba2f9ad2 100644 --- a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp @@ -237,14 +237,14 @@ ReplyInterpreter::Read(void* buffer, uint32* size, bool* eof) status_t -ReplyInterpreter::ReadDir(uint64* cookie, DirEntry** dirents, uint32* _count, - bool* eof) +ReplyInterpreter::ReadDir(uint64* cookie, uint64* cookieVerf, + DirEntry** dirents, uint32* _count, bool* eof) { status_t res = _OperationError(OpReadDir); if (res != B_OK) return res; - cookie[1] = fReply->Stream().GetUHyper(); + *cookieVerf = fReply->Stream().GetUHyper(); bool isNext; uint32 count = 0; @@ -254,7 +254,7 @@ ReplyInterpreter::ReadDir(uint64* cookie, DirEntry** dirents, uint32* _count, isNext = fReply->Stream().GetBoolean(); while (isNext && count < *_count) { - cookie[0] = fReply->Stream().GetUHyper(); + *cookie = fReply->Stream().GetUHyper(); entries[count].fName = fReply->Stream().GetString(); _DecodeAttrs(fReply->Stream(), &entries[count].fAttrs, diff --git a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.h b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.h index f49c2252a7..f2ed9168e1 100644 --- a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.h +++ b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.h @@ -75,8 +75,8 @@ public: inline status_t PutFH(); inline status_t PutRootFH(); status_t Read(void* buffer, uint32* size, bool* eof); - status_t ReadDir(uint64* cookie, DirEntry** dirents, - uint32* count, bool* eof); + status_t ReadDir(uint64* cookie, uint64* cookieVerf, + DirEntry** dirents, uint32* count, bool* eof); status_t ReadLink(void* buffer, uint32* size, uint32 maxSize); inline status_t Renew(); status_t SetClientID(uint64* clientid, uint64* verifier); diff --git a/src/add-ons/kernel/file_systems/nfs4/Request.cpp b/src/add-ons/kernel/file_systems/nfs4/Request.cpp index fdf9871086..9e39a36b05 100644 --- a/src/add-ons/kernel/file_systems/nfs4/Request.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/Request.cpp @@ -7,15 +7,16 @@ */ +#include "Inode.h" #include "Request.h" status_t -Request::Send() +Request::Send(Cookie* cookie) { switch (fServer->ID().fProtocol) { - case ProtocolUDP: return _SendUDP(); - case ProtocolTCP: return _SendTCP(); + case ProtocolUDP: return _SendUDP(cookie); + case ProtocolTCP: return _SendTCP(cookie); } return B_BAD_VALUE; @@ -23,41 +24,61 @@ Request::Send() status_t -Request::_SendUDP() +Request::_SendUDP(Cookie* cookie) { - RPC::Reply *rpl; + RPC::Reply *rpl = NULL; RPC::Request *rpc; status_t result = fServer->SendCallAsync(fBuilder.Request(), &rpl, &rpc); if (result != B_OK) return result; + if (cookie != NULL) + cookie->RegisterRequest(rpc); + result = fServer->WaitCall(rpc); if (result != B_OK) { int attempts = 1; while (result != B_OK && attempts++ < kRetryLimit) { result = fServer->ResendCallAsync(fBuilder.Request(), rpc); - if (result != B_OK) + if (result != B_OK) { + if (cookie != NULL) + cookie->UnregisterRequest(rpc); return result; + } result = fServer->WaitCall(rpc); } if (result != B_OK) { + if (cookie != NULL) + cookie->UnregisterRequest(rpc); fServer->CancelCall(rpc); delete rpc; return result; } } - return fReply.SetTo(rpl); + if (cookie != NULL) + cookie->UnregisterRequest(rpc); + + if (rpc->fError != B_OK) { + delete rpl; + result = rpc->fError; + delete rpc; + return result; + } else { + fReply.SetTo(rpl); + delete rpc; + return B_OK; + } } status_t -Request::_SendTCP() +Request::_SendTCP(Cookie* cookie) { - RPC::Reply *rpl; + RPC::Reply *rpl = NULL; RPC::Request *rpc; status_t result; @@ -71,8 +92,14 @@ Request::_SendTCP() continue; } + if (cookie != NULL) + cookie->RegisterRequest(rpc); + result = fServer->WaitCall(rpc); if (result != B_OK) { + if (cookie != NULL) + cookie->UnregisterRequest(rpc); + fServer->CancelCall(rpc); delete rpc; @@ -80,7 +107,19 @@ Request::_SendTCP() } } while (result != B_OK && attempts++ < kRetryLimit); - return fReply.SetTo(rpl); + if (cookie != NULL) + cookie->UnregisterRequest(rpc); + + if (rpc->fError != B_OK) { + delete rpl; + result = rpc->fError; + delete rpc; + return result; + } else { + fReply.SetTo(rpl); + delete rpc; + return B_OK; + }; } diff --git a/src/add-ons/kernel/file_systems/nfs4/Request.h b/src/add-ons/kernel/file_systems/nfs4/Request.h index 317bd3fbd4..cb8e5e02f4 100644 --- a/src/add-ons/kernel/file_systems/nfs4/Request.h +++ b/src/add-ons/kernel/file_systems/nfs4/Request.h @@ -14,6 +14,8 @@ #include "RPCServer.h" +class Cookie; + class Request { public: inline Request(RPC::Server* serv); @@ -21,12 +23,12 @@ public: inline RequestBuilder& Builder(); inline ReplyInterpreter& Reply(); - status_t Send(); + status_t Send(Cookie* cookie = NULL); void Reset(); private: - status_t _SendUDP(); - status_t _SendTCP(); + status_t _SendUDP(Cookie* cookie); + status_t _SendTCP(Cookie* cookie); RPC::Server* fServer; diff --git a/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.cpp b/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.cpp index 35bcb2c1fb..dbfdd377f8 100644 --- a/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.cpp @@ -267,8 +267,8 @@ RequestBuilder::Read(const uint32* id, uint32 stateSeq, uint64 pos, uint32 len) status_t -RequestBuilder::ReadDir(uint32 count, uint64* cookie, Attribute* attrs, - uint32 attrCount) +RequestBuilder::ReadDir(uint32 count, uint64 cookie, uint64 cookieVerf, + Attribute* attrs, uint32 attrCount) { (void)count; @@ -278,8 +278,8 @@ RequestBuilder::ReadDir(uint32 count, uint64* cookie, Attribute* attrs, return B_NO_MEMORY; fRequest->Stream().AddUInt(OpReadDir); - fRequest->Stream().AddUHyper(cookie[0]); - fRequest->Stream().AddUHyper(cookie[1]); + fRequest->Stream().AddUHyper(cookie); + fRequest->Stream().AddUHyper(cookieVerf); // consider predicting this values basing on count or buffer size fRequest->Stream().AddUInt(0x2000); diff --git a/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.h b/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.h index a557c65344..12005dba89 100644 --- a/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.h +++ b/src/add-ons/kernel/file_systems/nfs4/RequestBuilder.h @@ -40,8 +40,9 @@ public: status_t PutRootFH(); status_t Read(const uint32* id, uint32 stateSeq, uint64 pos, uint32 len); - status_t ReadDir(uint32 count, uint64* cookie, - Attribute* attrs, uint32 attrCount); + status_t ReadDir(uint32 count, uint64 cookie, + uint64 cookieVerf, Attribute* attrs, + uint32 attrCount); status_t ReadLink(); status_t Renew(uint64 clientId); status_t SetClientID(const RPC::Server* serv); diff --git a/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp b/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp index 4f48d66037..6ed7b435e3 100644 --- a/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp @@ -253,9 +253,15 @@ nfs4_open(fs_volume* volume, fs_vnode* vnode, int openMode, void** _cookie) static status_t -nfs4_close(fs_volume* volume, fs_vnode* vnode, void* cookie) +nfs4_close(fs_volume* volume, fs_vnode* vnode, void* _cookie) { - return B_OK; + Inode* inode = reinterpret_cast(vnode->private_node); + + if (inode->Type() == S_IFDIR || inode->Type() == S_IFLNK) + return B_OK; + + Cookie* cookie = reinterpret_cast(_cookie); + return cookie->CancelAll(); } @@ -296,7 +302,7 @@ nfs4_read(fs_volume* volume, fs_vnode* vnode, void* _cookie, off_t pos, static status_t nfs4_open_dir(fs_volume* volume, fs_vnode* vnode, void** _cookie) { - uint64* cookie = new(std::nothrow) uint64[2]; + OpenDirCookie* cookie = new(std::nothrow) OpenDirCookie; if (cookie == NULL) return B_NO_MEMORY; *_cookie = cookie; @@ -311,16 +317,17 @@ nfs4_open_dir(fs_volume* volume, fs_vnode* vnode, void** _cookie) static status_t -nfs4_close_dir(fs_volume* volume, fs_vnode* vnode, void* cookie) +nfs4_close_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie) { - return B_OK; + Cookie* cookie = reinterpret_cast(_cookie); + return cookie->CancelAll(); } static status_t nfs4_free_dir_cookie(fs_volume* volume, fs_vnode* vnode, void* cookie) { - delete[] reinterpret_cast(cookie); + delete reinterpret_cast(cookie); return B_OK; } @@ -329,7 +336,7 @@ static status_t nfs4_read_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie, struct dirent* buffer, size_t bufferSize, uint32* _num) { - uint64* cookie = reinterpret_cast(_cookie); + OpenDirCookie* cookie = reinterpret_cast(_cookie); Inode* inode = reinterpret_cast(vnode->private_node); return inode->ReadDir(buffer, bufferSize, _num, cookie); }