Search in sources :

Example 1 with Inode

use of org.dcache.nfs.vfs.Inode in project dcache by dCache.

the class MonitoringVfs method mkdir.

@Override
public Inode mkdir(Inode parent, String name, Subject subject, int mode) throws IOException {
    Inode dir = super.mkdir(parent, name, subject, mode);
    toPnfsId(parent).ifPresent(id -> eventReceiver.notifyChildEvent(IN_CREATE, id, name, FileType.DIR));
    return dir;
}
Also used : FsInode(org.dcache.chimera.FsInode) Inode(org.dcache.nfs.vfs.Inode)

Example 2 with Inode

use of org.dcache.nfs.vfs.Inode in project dcache by dCache.

the class MonitoringVfs method create.

@Override
public Inode create(Inode parent, Stat.Type type, String name, Subject subject, int mode) throws IOException {
    Inode target = super.create(parent, type, name, subject, mode);
    toPnfsId(parent).ifPresent(id -> eventReceiver.notifyChildEvent(IN_CREATE, id, name, asFileType(type)));
    return target;
}
Also used : FsInode(org.dcache.chimera.FsInode) Inode(org.dcache.nfs.vfs.Inode)

Example 3 with Inode

use of org.dcache.nfs.vfs.Inode in project dcache by dCache.

the class MonitoringVfs method symlink.

@Override
public Inode symlink(Inode parent, String name, String target, Subject subject, int mode) throws IOException {
    Inode symlink = super.symlink(parent, name, target, subject, mode);
    toPnfsId(parent).ifPresent(id -> eventReceiver.notifyChildEvent(IN_CREATE, id, name, FileType.LINK));
    return symlink;
}
Also used : FsInode(org.dcache.chimera.FsInode) Inode(org.dcache.nfs.vfs.Inode)

Example 4 with Inode

use of org.dcache.nfs.vfs.Inode in project dcache by dCache.

the class ChimeraVfs method list.

@Override
public DirectoryStream list(Inode inode, byte[] verifier, long cookie) throws IOException {
    FsInode parentFsInode = toFsInode(inode);
    // ignore whatever is sent by client
    byte[] currentVerifier = directoryVerifier(inode);
    try (Stream<ChimeraDirectoryEntry> dirStream = DirectoryStreamHelper.streamOf(parentFsInode)) {
        TreeSet<DirectoryEntry> list = dirStream.map(e -> new DirectoryEntry(e.getName(), toInode(e.getInode()), fromChimeraStat(e.getStat()), directoryCookieOf(e.getStat(), e.getName()))).collect(Collectors.toCollection(TreeSet::new));
        return new DirectoryStream(currentVerifier, list);
    }
}
Also used : AceType(org.dcache.acl.enums.AceType) org.dcache.nfs.v4.xdr.acetype4(org.dcache.nfs.v4.xdr.acetype4) Arrays(java.util.Arrays) FsInode(org.dcache.chimera.FsInode) NoEntException(org.dcache.nfs.status.NoEntException) IsDirException(org.dcache.nfs.status.IsDirException) LoggerFactory(org.slf4j.LoggerFactory) FileState(org.dcache.chimera.FileState) org.dcache.nfs.v4.xdr.acemask4(org.dcache.nfs.v4.xdr.acemask4) ByteBuffer(java.nio.ByteBuffer) InvalidArgumentChimeraException(org.dcache.chimera.InvalidArgumentChimeraException) UnixPermission(org.dcache.chimera.UnixPermission) FsInode_PCUR(org.dcache.chimera.FsInode_PCUR) FsInode_PLOC(org.dcache.chimera.FsInode_PLOC) BadHandleException(org.dcache.nfs.status.BadHandleException) FsInode_CKSTYP(org.dcache.chimera.FsInode_CKSTYP) DirectoryStreamHelper(org.dcache.chimera.DirectoryStreamHelper) Stat(org.dcache.nfs.vfs.Stat) NotDirException(org.dcache.nfs.status.NotDirException) StorageGenericLocation(org.dcache.chimera.StorageGenericLocation) InvalException(org.dcache.nfs.status.InvalException) FsInode_PATHOF(org.dcache.chimera.FsInode_PATHOF) ACE4_INHERIT_ONLY_ACE(org.dcache.nfs.v4.xdr.nfs4_prot.ACE4_INHERIT_ONLY_ACE) FsStat(org.dcache.nfs.vfs.FsStat) NotDirChimeraException(org.dcache.chimera.NotDirChimeraException) PermissionDeniedChimeraFsException(org.dcache.chimera.PermissionDeniedChimeraFsException) FsInode_PCRC(org.dcache.chimera.FsInode_PCRC) NoXdataChimeraException(org.dcache.chimera.NoXdataChimeraException) FileSystemProvider(org.dcache.chimera.FileSystemProvider) NfsIdMapping(org.dcache.nfs.v4.NfsIdMapping) NotEmptyException(org.dcache.nfs.status.NotEmptyException) Collectors(java.util.stream.Collectors) org.dcache.nfs.v4.xdr.nfsace4(org.dcache.nfs.v4.xdr.nfsace4) StandardCharsets(java.nio.charset.StandardCharsets) FsInode_CONST(org.dcache.chimera.FsInode_CONST) org.dcache.nfs.v4.xdr.aceflag4(org.dcache.nfs.v4.xdr.aceflag4) NoXattrException(org.dcache.nfs.status.NoXattrException) JdbcFs(org.dcache.chimera.JdbcFs) List(java.util.List) Stream(java.util.stream.Stream) org.dcache.nfs.v4.xdr.verifier4(org.dcache.nfs.v4.xdr.verifier4) FsInode_PSET(org.dcache.chimera.FsInode_PSET) Optional(java.util.Optional) ChimeraFsException(org.dcache.chimera.ChimeraFsException) DirNotEmptyChimeraFsException(org.dcache.chimera.DirNotEmptyChimeraFsException) FsInode_TAG(org.dcache.chimera.FsInode_TAG) AccessController(java.security.AccessController) ChimeraDirectoryEntry(org.dcache.chimera.ChimeraDirectoryEntry) DQuotException(org.dcache.nfs.status.DQuotException) StaleException(org.dcache.nfs.status.StaleException) AceFlags(org.dcache.acl.enums.AceFlags) FsInode_PINS(org.dcache.chimera.FsInode_PINS) ACCESS4_EXTEND(org.dcache.nfs.v4.xdr.nfs4_prot.ACCESS4_EXTEND) ACCESS4_MODIFY(org.dcache.nfs.v4.xdr.nfs4_prot.ACCESS4_MODIFY) DirectoryEntry(org.dcache.nfs.vfs.DirectoryEntry) QuotaChimeraFsException(org.dcache.chimera.QuotaChimeraFsException) FsInodeType(org.dcache.chimera.FsInodeType) TreeSet(java.util.TreeSet) IsDirChimeraException(org.dcache.chimera.IsDirChimeraException) NfsIoException(org.dcache.nfs.status.NfsIoException) ArrayList(java.util.ArrayList) FileExistsChimeraFsException(org.dcache.chimera.FileExistsChimeraFsException) BadOwnerException(org.dcache.nfs.status.BadOwnerException) ExistException(org.dcache.nfs.status.ExistException) StringTokenizer(java.util.StringTokenizer) Acls(org.dcache.nfs.v4.acl.Acls) DirectoryStream(org.dcache.nfs.vfs.DirectoryStream) FsInode_NAMEOF(org.dcache.chimera.FsInode_NAMEOF) org.dcache.nfs.v4.xdr.utf8str_mixed(org.dcache.nfs.v4.xdr.utf8str_mixed) FsInode_ID(org.dcache.chimera.FsInode_ID) STAT(org.dcache.chimera.FileSystemProvider.StatCacheOption.STAT) PermException(org.dcache.nfs.status.PermException) Inode(org.dcache.nfs.vfs.Inode) AclCheckable(org.dcache.nfs.vfs.AclCheckable) Who(org.dcache.acl.enums.Who) org.dcache.nfs.v4.xdr.uint32_t(org.dcache.nfs.v4.xdr.uint32_t) Logger(org.slf4j.Logger) UTF_8(java.nio.charset.StandardCharsets.UTF_8) UnixSubjects(org.dcache.nfs.util.UnixSubjects) FsInode_PARENT(org.dcache.chimera.FsInode_PARENT) IOException(java.io.IOException) ACE(org.dcache.acl.ACE) Subject(javax.security.auth.Subject) NO_STAT(org.dcache.chimera.FileSystemProvider.StatCacheOption.NO_STAT) FsInode_SURI(org.dcache.chimera.FsInode_SURI) FsInode_TAGS(org.dcache.chimera.FsInode_TAGS) FileNotFoundChimeraFsException(org.dcache.chimera.FileNotFoundChimeraFsException) VisibleForTesting(com.google.common.annotations.VisibleForTesting) VirtualFileSystem(org.dcache.nfs.vfs.VirtualFileSystem) FsInode(org.dcache.chimera.FsInode) DirectoryStream(org.dcache.nfs.vfs.DirectoryStream) ChimeraDirectoryEntry(org.dcache.chimera.ChimeraDirectoryEntry) DirectoryEntry(org.dcache.nfs.vfs.DirectoryEntry) ChimeraDirectoryEntry(org.dcache.chimera.ChimeraDirectoryEntry)

Example 5 with Inode

use of org.dcache.nfs.vfs.Inode in project dcache by dCache.

the class MonitoringVfsTest method shouldNotNotifyOnUnsuccessfulSetAcl.

@Test
public void shouldNotNotifyOnUnsuccessfulSetAcl() throws Exception {
    PnfsId parentId = new PnfsId("000000000000000000000000000000000001");
    PnfsId targetId = new PnfsId("000000000000000000000000000000000002");
    Inode parent = anInode().withId(1L).withPnfsId(parentId).build();
    Inode target = anInode().withId(2L).withPnfsId(targetId).withLink(parent, "target").withStat(aStat().withMode(0644).withType(REGULAR)).build();
    nfsace4[] acl = {};
    willThrow(IOException.class).given(inner).setAcl(any(), any());
    try {
        monitor.setAcl(target, acl);
        fail("setAcl unexpectedly succeeded");
    } catch (IOException e) {
    }
    verify(inner).setAcl(target, acl);
    verify(receiver, never()).notifyChildEvent(any(), any(), any(), any());
    verify(receiver, never()).notifySelfEvent(any(), any(), any());
    verify(receiver, never()).notifyMovedEvent(any(), any(), any(), any(), any());
}
Also used : org.dcache.nfs.v4.xdr.nfsace4(org.dcache.nfs.v4.xdr.nfsace4) FsInode(org.dcache.chimera.FsInode) Inode(org.dcache.nfs.vfs.Inode) PnfsId(diskCacheV111.util.PnfsId) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

Inode (org.dcache.nfs.vfs.Inode)35 FsInode (org.dcache.chimera.FsInode)32 Test (org.junit.Test)23 PnfsId (diskCacheV111.util.PnfsId)22 IOException (java.io.IOException)16 org.dcache.nfs.v4.xdr.stateid4 (org.dcache.nfs.v4.xdr.stateid4)4 ByteBuffer (java.nio.ByteBuffer)3 Stat (org.dcache.nfs.vfs.Stat)3 ChimeraFsException (org.dcache.chimera.ChimeraFsException)2 FileType (org.dcache.namespace.FileType)2 ChimeraNFSException (org.dcache.nfs.ChimeraNFSException)2 AccessException (org.dcache.nfs.status.AccessException)2 NFS4Client (org.dcache.nfs.v4.NFS4Client)2 NFS4State (org.dcache.nfs.v4.NFS4State)2 org.dcache.nfs.v4.xdr.nfsace4 (org.dcache.nfs.v4.xdr.nfsace4)2 InOrder (org.mockito.InOrder)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Hasher (com.google.common.hash.Hasher)1 CacheException (diskCacheV111.util.CacheException)1 FileNotFoundCacheException (diskCacheV111.util.FileNotFoundCacheException)1