HDFS-13363. Record file path when FSDirAclOp throws AclException. Contributed by Gabor Bota.

This commit is contained in:
Xiao Chen 2018-04-10 11:19:23 -07:00
parent f89594f0b8
commit e76c2aeb28
2 changed files with 22 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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<AclEntry> 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();
}