|
@@ -67,7 +67,7 @@ import static org.apache.hadoop.hdfs.server.common.HdfsServerConstants
|
|
|
|
|
|
/**
|
|
/**
|
|
* Manages the list of encryption zones in the filesystem.
|
|
* Manages the list of encryption zones in the filesystem.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* The EncryptionZoneManager has its own lock, but relies on the FSDirectory
|
|
* The EncryptionZoneManager has its own lock, but relies on the FSDirectory
|
|
* lock being held for many operations. The FSDirectory lock should not be
|
|
* lock being held for many operations. The FSDirectory lock should not be
|
|
* taken if the manager lock is already held.
|
|
* taken if the manager lock is already held.
|
|
@@ -294,7 +294,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Add a new encryption zone.
|
|
* Add a new encryption zone.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*
|
|
*
|
|
* @param inodeId of the encryption zone
|
|
* @param inodeId of the encryption zone
|
|
@@ -308,7 +308,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Add a new encryption zone.
|
|
* Add a new encryption zone.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Does not assume that the FSDirectory lock is held.
|
|
* Does not assume that the FSDirectory lock is held.
|
|
*
|
|
*
|
|
* @param inodeId of the encryption zone
|
|
* @param inodeId of the encryption zone
|
|
@@ -326,7 +326,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Remove an encryption zone.
|
|
* Remove an encryption zone.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
void removeEncryptionZone(Long inodeId) {
|
|
void removeEncryptionZone(Long inodeId) {
|
|
@@ -344,7 +344,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Returns true if an IIP is within an encryption zone.
|
|
* Returns true if an IIP is within an encryption zone.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
boolean isInAnEZ(INodesInPath iip) throws UnresolvedLinkException,
|
|
boolean isInAnEZ(INodesInPath iip) throws UnresolvedLinkException,
|
|
@@ -355,7 +355,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Returns the full path from an INode id.
|
|
* Returns the full path from an INode id.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
String getFullPathName(Long nodeId) {
|
|
String getFullPathName(Long nodeId) {
|
|
@@ -370,7 +370,7 @@ public class EncryptionZoneManager {
|
|
/**
|
|
/**
|
|
* Get the key name for an encryption zone. Returns null if <tt>iip</tt> is
|
|
* Get the key name for an encryption zone. Returns null if <tt>iip</tt> is
|
|
* not within an encryption zone.
|
|
* not within an encryption zone.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
String getKeyName(final INodesInPath iip) throws IOException {
|
|
String getKeyName(final INodesInPath iip) throws IOException {
|
|
@@ -385,7 +385,7 @@ public class EncryptionZoneManager {
|
|
/**
|
|
/**
|
|
* Looks up the EncryptionZoneInt for a path within an encryption zone.
|
|
* Looks up the EncryptionZoneInt for a path within an encryption zone.
|
|
* Returns null if path is not within an EZ.
|
|
* Returns null if path is not within an EZ.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
private EncryptionZoneInt getEncryptionZoneForPath(INodesInPath iip)
|
|
private EncryptionZoneInt getEncryptionZoneForPath(INodesInPath iip)
|
|
@@ -434,7 +434,7 @@ public class EncryptionZoneManager {
|
|
* Looks up the nearest ancestor EncryptionZoneInt that contains the given
|
|
* Looks up the nearest ancestor EncryptionZoneInt that contains the given
|
|
* path (excluding itself).
|
|
* path (excluding itself).
|
|
* Returns null if path is not within an EZ, or the path is the root dir '/'
|
|
* Returns null if path is not within an EZ, or the path is the root dir '/'
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
private EncryptionZoneInt getParentEncryptionZoneForPath(INodesInPath iip)
|
|
private EncryptionZoneInt getParentEncryptionZoneForPath(INodesInPath iip)
|
|
@@ -467,7 +467,7 @@ public class EncryptionZoneManager {
|
|
/**
|
|
/**
|
|
* Throws an exception if the provided path cannot be renamed into the
|
|
* Throws an exception if the provided path cannot be renamed into the
|
|
* destination because of differing parent encryption zones.
|
|
* destination because of differing parent encryption zones.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*
|
|
*
|
|
* @param srcIIP source IIP
|
|
* @param srcIIP source IIP
|
|
@@ -529,7 +529,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Create a new encryption zone.
|
|
* Create a new encryption zone.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
XAttr createEncryptionZone(INodesInPath srcIIP, CipherSuite suite,
|
|
XAttr createEncryptionZone(INodesInPath srcIIP, CipherSuite suite,
|
|
@@ -573,7 +573,7 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Cursor-based listing of encryption zones.
|
|
* Cursor-based listing of encryption zones.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
*/
|
|
*/
|
|
BatchedListEntries<EncryptionZone> listEncryptionZones(long prevId)
|
|
BatchedListEntries<EncryptionZone> listEncryptionZones(long prevId)
|
|
@@ -621,6 +621,8 @@ public class EncryptionZoneManager {
|
|
* @param zoneId
|
|
* @param zoneId
|
|
* @param zonePath
|
|
* @param zonePath
|
|
* @return true if path resolve to the id, false if not.
|
|
* @return true if path resolve to the id, false if not.
|
|
|
|
+ * @throws AccessControlException
|
|
|
|
+ * @throws ParentNotDirectoryException
|
|
* @throws UnresolvedLinkException
|
|
* @throws UnresolvedLinkException
|
|
*/
|
|
*/
|
|
private boolean pathResolvesToId(final long zoneId, final String zonePath)
|
|
private boolean pathResolvesToId(final long zoneId, final String zonePath)
|
|
@@ -645,6 +647,9 @@ public class EncryptionZoneManager {
|
|
/**
|
|
/**
|
|
* Re-encrypts the given encryption zone path. If the given path is not the
|
|
* Re-encrypts the given encryption zone path. If the given path is not the
|
|
* root of an encryption zone, an exception is thrown.
|
|
* root of an encryption zone, an exception is thrown.
|
|
|
|
+ * @param zoneIIP
|
|
|
|
+ * @param keyVersionName
|
|
|
|
+ * @throws IOException
|
|
*/
|
|
*/
|
|
List<XAttr> reencryptEncryptionZone(final INodesInPath zoneIIP,
|
|
List<XAttr> reencryptEncryptionZone(final INodesInPath zoneIIP,
|
|
final String keyVersionName) throws IOException {
|
|
final String keyVersionName) throws IOException {
|
|
@@ -673,7 +678,9 @@ public class EncryptionZoneManager {
|
|
/**
|
|
/**
|
|
* Cancels the currently-running re-encryption of the given encryption zone.
|
|
* Cancels the currently-running re-encryption of the given encryption zone.
|
|
* If the given path is not the root of an encryption zone,
|
|
* If the given path is not the root of an encryption zone,
|
|
- * * an exception is thrown.
|
|
|
|
|
|
+ * an exception is thrown.
|
|
|
|
+ * @param zoneIIP
|
|
|
|
+ * @throws IOException
|
|
*/
|
|
*/
|
|
List<XAttr> cancelReencryptEncryptionZone(final INodesInPath zoneIIP)
|
|
List<XAttr> cancelReencryptEncryptionZone(final INodesInPath zoneIIP)
|
|
throws IOException {
|
|
throws IOException {
|
|
@@ -693,8 +700,10 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Cursor-based listing of zone re-encryption status.
|
|
* Cursor-based listing of zone re-encryption status.
|
|
- * <p/>
|
|
|
|
|
|
+ * <p>
|
|
* Called while holding the FSDirectory lock.
|
|
* Called while holding the FSDirectory lock.
|
|
|
|
+ * @param prevId
|
|
|
|
+ * @throws IOException
|
|
*/
|
|
*/
|
|
BatchedListEntries<ZoneReencryptionStatus> listReencryptionStatus(
|
|
BatchedListEntries<ZoneReencryptionStatus> listReencryptionStatus(
|
|
final long prevId) throws IOException {
|
|
final long prevId) throws IOException {
|
|
@@ -735,6 +744,10 @@ public class EncryptionZoneManager {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Return whether an INode is an encryption zone root.
|
|
* Return whether an INode is an encryption zone root.
|
|
|
|
+ * @param inode
|
|
|
|
+ * @param name
|
|
|
|
+ * @return true when INode is an encryption zone root else false
|
|
|
|
+ * @throws FileNotFoundException
|
|
*/
|
|
*/
|
|
boolean isEncryptionZoneRoot(final INode inode, final String name)
|
|
boolean isEncryptionZoneRoot(final INode inode, final String name)
|
|
throws FileNotFoundException {
|
|
throws FileNotFoundException {
|
|
@@ -756,6 +769,7 @@ public class EncryptionZoneManager {
|
|
* Return whether an INode is an encryption zone root.
|
|
* Return whether an INode is an encryption zone root.
|
|
*
|
|
*
|
|
* @param inode the zone inode
|
|
* @param inode the zone inode
|
|
|
|
+ * @param name
|
|
* @throws IOException if the inode is not a directory,
|
|
* @throws IOException if the inode is not a directory,
|
|
* or is a directory but not the root of an EZ.
|
|
* or is a directory but not the root of an EZ.
|
|
*/
|
|
*/
|