Skip to content

Commit

Permalink
doors: allow Transfer to accept a subject to talk to namespace
Browse files Browse the repository at this point in the history
allow transfer to use a different subject for namespace and pool
operations. Update NFS door to use it.

Acked-by: Dmitry Litvintsev
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Oct 5, 2013
1 parent 6af0e95 commit affbd5f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ public Layout layoutGet(CompoundContext context, Inode nfsInode, int ioMode, sta
InetSocketAddress remote = context.getRpcCall().getTransport().getRemoteSocketAddress();
PnfsId pnfsId = new PnfsId(inode.toString());
Transfer.initSession();
NfsTransfer transfer = new NfsTransfer(_pnfsHandler, Subjects.ROOT, new FsPath("/"),
NfsTransfer transfer = new NfsTransfer(_pnfsHandler, Subjects.ROOT,
context.getRpcCall().getCredential().getSubject(),
remote, stateid);

NFS4ProtocolInfo protocolInfo = transfer.getProtocolInfoForPool();
Expand Down Expand Up @@ -594,9 +595,9 @@ private static class NfsTransfer extends RedirectedTransfer<PoolDS> {
private final stateid4 _stateid;
private final NFS4ProtocolInfo _protocolInfo;

NfsTransfer(PnfsHandler pnfs, Subject subject, FsPath path, InetSocketAddress client,
NfsTransfer(PnfsHandler pnfs, Subject namespaceSubject, Subject ioSubject, InetSocketAddress client,
stateid4 stateid) {
super(pnfs, subject, path);
super(pnfs, namespaceSubject, ioSubject, new FsPath("/"));
_stateid = stateid;
_protocolInfo = new NFS4ProtocolInfo(client, _stateid);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public class RedirectedTransfer<T> extends Transfer
private boolean _isRedirected;
private T _redirectObject;

public RedirectedTransfer(PnfsHandler pnfs, Subject namespaceSubject, Subject subject, FsPath path) {
super(pnfs, namespaceSubject, subject, path);
}

public RedirectedTransfer(PnfsHandler pnfs, Subject subject, FsPath path) {
super(pnfs, subject, path);
}
Expand Down
22 changes: 17 additions & 5 deletions modules/dcache/src/main/java/org/dcache/util/Transfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,32 @@ public class Transfer implements Comparable<Transfer>
* Constructs a new Transfer object.
*
* @param pnfs PnfsHandler used for pnfs communication
* @param subject The subject performing the transfer
* @param namespaceSubject The subject performing the namespace operations
* @param ioSubject The subject performing the transfer
* @param path The path of the file to transfer
*/
public Transfer(PnfsHandler pnfs, Subject subject, FsPath path)
{
_pnfs = new PnfsHandler(pnfs, subject);
_subject = subject;
public Transfer(PnfsHandler pnfs, Subject namespaceSubject, Subject ioSubject, FsPath path) {
_pnfs = new PnfsHandler(pnfs, namespaceSubject);
_subject = ioSubject;
_path = path;
_startedAt = System.currentTimeMillis();
_sessionId = _sessionCounter.next();
_session = CDC.getSession();
_checkStagePermission = new CheckStagePermission(null);
}

/**
* Constructs a new Transfer object.
*
* @param pnfs PnfsHandler used for pnfs communication
* @param subject The subject performing the transfer and namespace operations
* @param path The path of the file to transfer
*/
public Transfer(PnfsHandler pnfs, Subject subject, FsPath path)
{
this(pnfs, subject, subject, path);
}

/**
* Returns a ProtocolInfo suitable for selecting a pool. By
* default the protocol info set with setProtocolInfo is returned.
Expand Down

0 comments on commit affbd5f

Please sign in to comment.