From: František Dvořák Date: Sun, 23 Feb 2014 12:08:31 +0000 (+0100) Subject: Look at replica status too in accessReplica(). X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=8b3c69cf31889b3e767efe1ca7e0c2405f426d41;p=dmlite-plugins-vfs.git Look at replica status too in accessReplica(). --- diff --git a/src/VfsNs.cpp b/src/VfsNs.cpp index 567702d..f7d5d1d 100644 --- a/src/VfsNs.cpp +++ b/src/VfsNs.cpp @@ -516,12 +516,28 @@ bool VfsCatalog::access(const std::string& path, int mode) throw (DmException) } -bool VfsCatalog::accessReplica(const std::string& replica, int mode) throw (DmException) +bool VfsCatalog::accessReplica(const std::string& rfn, int mode) throw (DmException) { std::string path; + Replica replica; + bool metaAllowed, replicaAllowed; + + try { + replica = this->getReplicaByRFN(rfn); + if (mode & W_OK) { + replicaAllowed = (replica.status == Replica::kBeingPopulated); + } else { + replicaAllowed = true; + } - path = vfsPathByRFN(replica); - return this->access(path, mode); + path = vfsPathByRFN(rfn); + metaAllowed = this->access(path, mode); + + return metaAllowed && replicaAllowed; + } catch (DmException& e) { + if (e.code() != EACCES) throw; + return false; + } } @@ -1537,7 +1553,7 @@ Replica VfsCatalog::getReplicaByRFN(const std::string& rfn) throw (DmException) return replica; } - + void VfsCatalog::updateReplica(const Replica& replica) throw (DmException)