code: private FSPermissionChecker checkPermission(String path, INode[] inodes, boolean doCheckOwner,
                                                FsAction ancestorAccess, FsAction parentAccess, FsAction access,
                                                FsAction subAccess)
      throws AccessControlException {
      boolean permissionCheckFailed = false;
      FSPermissionChecker pc = new FSPermissionChecker(
        fsOwner.getUserName(), supergroup, this.getCurrentUGI());
      if (!pc.isSuper) {
        dir.waitForReady();
        readLock();
        try {
          pc.checkPermission(path, inodes, doCheckOwner,
            ancestorAccess, parentAccess, access, subAccess);
        } catch (AccessControlException e) {
          if (!this.permissionAuditOnly) {
            throw e;
          }
          permissionCheckFailed = true;
        } finally {
          readUnlock();
        }
      }
      if (permissionCheckFailed) {
        // do not throw the exception, we would like to only log.
        LOG.warn("PermissionAudit failed on " + path +
          " checkOwner:" + doCheckOwner +
          " ancestor:" + ancestorAccess +
          " parent:" + parentAccess +
          " access:" + access +
          " subaccess:" + subAccess);
      }
      return pc;
    }
docs: Check whether current user have permissions to access the path.
  For more details of the parameters, see
  {@link FSPermissionChecker#checkPermission(String, INodeDirectory, boolean, FsAction, FsAction, FsAction, FsAction)}.