If a EZ directory is under a snapshotable directory, and a snapshot has been taking, then if this EZ is permanently deleted, it causes hdfs crypto listZones command to fail without showing any of the still available zones.
This happens only after the EZ is removed from Trash folder. For example, considering /test-snap folder is snapshotable and there is already an snapshot for it:
Once this error happens, hdfs crypto -listZones only works again if we remove the snapshot:
If we instead delete the EZ using skipTrash option, hdfs crypto -listZones does not break:
The different behaviour seems to be because when removing the EZ trash folder, it's related INode is left with no parent INode. This causes EncryptionZoneManager.listEncryptionZones to throw the seen error, when trying to resolve the inodes in the given path.
Am proposing a patch that fixes this issue by simply performing an additional check on EncryptionZoneManager.listEncryptionZones for the case an inode has no parent, so that it would be skipped on the list without trying to resolve it. Feedback on the proposal is appreciated.