nfs4: Recall all delegations when callback path is down
This commit is contained in:
@@ -311,11 +311,28 @@ FileSystem::RemoveOpenFile(OpenState* state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DoublyLinkedList<Delegation>&
|
||||||
|
FileSystem::DelegationsLock()
|
||||||
|
{
|
||||||
|
mutex_lock(&fDelegationLock);
|
||||||
|
return fDelegationList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FileSystem::DelegationsUnlock()
|
||||||
|
{
|
||||||
|
mutex_unlock(&fDelegationLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FileSystem::AddDelegation(Delegation* delegation)
|
FileSystem::AddDelegation(Delegation* delegation)
|
||||||
{
|
{
|
||||||
MutexLocker _(fDelegationLock);
|
MutexLocker _(fDelegationLock);
|
||||||
|
|
||||||
|
fDelegationList.InsertBefore(fDelegationList.Head(), delegation);
|
||||||
|
|
||||||
fHandleToDelegation.Remove(delegation->fInfo.fHandle);
|
fHandleToDelegation.Remove(delegation->fInfo.fHandle);
|
||||||
fHandleToDelegation.Insert(delegation->fInfo.fHandle, delegation);
|
fHandleToDelegation.Insert(delegation->fInfo.fHandle, delegation);
|
||||||
|
|
||||||
@@ -328,6 +345,7 @@ FileSystem::RemoveDelegation(Delegation* delegation)
|
|||||||
{
|
{
|
||||||
MutexLocker _(fDelegationLock);
|
MutexLocker _(fDelegationLock);
|
||||||
|
|
||||||
|
fDelegationList.Remove(delegation);
|
||||||
fHandleToDelegation.Remove(delegation->fInfo.fHandle);
|
fHandleToDelegation.Remove(delegation->fInfo.fHandle);
|
||||||
|
|
||||||
NFSServer()->DecUsage();
|
NFSServer()->DecUsage();
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public:
|
|||||||
void AddOpenFile(OpenState* state);
|
void AddOpenFile(OpenState* state);
|
||||||
void RemoveOpenFile(OpenState* state);
|
void RemoveOpenFile(OpenState* state);
|
||||||
|
|
||||||
|
DoublyLinkedList<Delegation>& DelegationsLock();
|
||||||
|
void DelegationsUnlock();
|
||||||
void AddDelegation(Delegation* delegation);
|
void AddDelegation(Delegation* delegation);
|
||||||
void RemoveDelegation(Delegation* delegation);
|
void RemoveDelegation(Delegation* delegation);
|
||||||
Delegation* GetDelegation(const FileHandle& handle);
|
Delegation* GetDelegation(const FileHandle& handle);
|
||||||
@@ -68,6 +70,7 @@ private:
|
|||||||
CacheRevalidator fCacheRevalidator;
|
CacheRevalidator fCacheRevalidator;
|
||||||
|
|
||||||
mutex fDelegationLock;
|
mutex fDelegationLock;
|
||||||
|
DoublyLinkedList<Delegation> fDelegationList;
|
||||||
AVLTreeMap<FileHandle, Delegation*> fHandleToDelegation;
|
AVLTreeMap<FileHandle, Delegation*> fHandleToDelegation;
|
||||||
|
|
||||||
OpenState* fOpenFiles;
|
OpenState* fOpenFiles;
|
||||||
|
|||||||
@@ -346,26 +346,26 @@ NFS4Server::CallbackRecall(RequestInterpreter* request, ReplyBuilder* reply)
|
|||||||
status_t
|
status_t
|
||||||
NFS4Server::RecallAll()
|
NFS4Server::RecallAll()
|
||||||
{
|
{
|
||||||
#if 0
|
MutexLocker _(fFSLock);
|
||||||
MutexLocker locker(fFSLock);
|
FileSystem* fs = fFileSystems;
|
||||||
|
while (fs != NULL) {
|
||||||
|
DoublyLinkedList<Delegation>& list = fs->DelegationsLock();
|
||||||
|
DoublyLinkedList<Delegation>::Iterator iterator = list.GetIterator();
|
||||||
|
|
||||||
Delegation* delegation = NULL;
|
Delegation* current = iterator.Next();
|
||||||
FileSystem* current = fFileSystems;
|
|
||||||
while (current != NULL) {
|
while (current != NULL) {
|
||||||
delegation = current->GetDelegation(handle);
|
DelegationRecallArgs* args = new(std::nothrow) DelegationRecallArgs;
|
||||||
if (delegation != NULL)
|
args->fDelegation = current;
|
||||||
break;
|
args->fTruncate = false;
|
||||||
|
|
||||||
current = current->fNext;
|
|
||||||
}
|
|
||||||
locker.Unlock();
|
|
||||||
|
|
||||||
DelegationRecallArgs args = new(std::nothrow) DelegationRecallArgs;
|
|
||||||
DelegationRecallArgs* args;
|
|
||||||
args->fDelegation = delegation;
|
|
||||||
args->fTruncate = truncate;
|
|
||||||
gWorkQueue->EnqueueJob(DelegationRecall, args);
|
gWorkQueue->EnqueueJob(DelegationRecall, args);
|
||||||
#endif
|
|
||||||
|
current = iterator.Next();
|
||||||
|
}
|
||||||
|
fs->DelegationsUnlock();
|
||||||
|
|
||||||
|
fs = fs->fNext;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user