From e76c2aeb288710ebee39680528dec44e454bbe9e Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Tue, 10 Apr 2018 11:19:23 -0700 Subject: [PATCH] HDFS-13363. Record file path when FSDirAclOp throws AclException. Contributed by Gabor Bota. --- .../apache/hadoop/hdfs/protocol/AclException.java | 10 ++++++++++ .../hadoop/hdfs/server/namenode/FSDirAclOp.java | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AclException.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AclException.java index 12109999d8d..9948b999d7a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AclException.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AclException.java @@ -36,4 +36,14 @@ public class AclException extends IOException { public AclException(String message) { super(message); } + + /** + * Creates a new AclException. + * + * @param message String message + * @param cause The cause of the exception + */ + public AclException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAclOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAclOp.java index 7b3471dcf59..8d77f894406 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAclOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAclOp.java @@ -53,6 +53,8 @@ class FSDirAclOp { existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); + } catch (AclException e){ + throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } @@ -77,6 +79,8 @@ class FSDirAclOp { existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); + } catch (AclException e){ + throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } @@ -100,6 +104,8 @@ class FSDirAclOp { existingAcl); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); + } catch (AclException e){ + throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } @@ -117,6 +123,8 @@ class FSDirAclOp { src = iip.getPath(); fsd.checkOwner(pc, iip); unprotectedRemoveAcl(fsd, iip); + } catch (AclException e){ + throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } @@ -136,6 +144,8 @@ class FSDirAclOp { fsd.checkOwner(pc, iip); List newAcl = unprotectedSetAcl(fsd, iip, aclSpec, false); fsd.getEditLog().logSetAcl(iip.getPath(), newAcl); + } catch (AclException e){ + throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } @@ -162,6 +172,8 @@ class FSDirAclOp { .stickyBit(fsPermission.getStickyBit()) .setPermission(fsPermission) .addEntries(acl).build(); + } catch (AclException e){ + throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.readUnlock(); }