diff --git a/core/modules/node/src/NodeGrantDatabaseStorage.php b/core/modules/node/src/NodeGrantDatabaseStorage.php
index 4bfeff0..8627392 100644
--- a/core/modules/node/src/NodeGrantDatabaseStorage.php
+++ b/core/modules/node/src/NodeGrantDatabaseStorage.php
@@ -87,6 +87,7 @@ public function access(NodeInterface $node, $operation, $langcode, AccountInterf
     if (count($grants) > 0) {
       $query->condition($grants);
     }
+    $access_result = $query->execute()->fetchField() ? AccessResult::allowed() : AccessResult::forbidden();
 
     // Only the 'view' node grant can currently be cached; the others currently
     // don't have any cacheability metadata. Hopefully, we can add that in the
@@ -94,20 +95,11 @@ public function access(NodeInterface $node, $operation, $langcode, AccountInterf
     // cases. For now, this must remain marked as uncacheable, even when it is
     // theoretically cacheable, because we don't have the necessary metadata to
     // know it for a fact.
-    $set_cacheability = function (AccessResult $access_result) use ($operation) {
-      if ($operation === 'view') {
-        return $access_result->addCacheContexts(['cache_context.node_view_grants']);
-      }
-      else {
-        return $access_result->setCacheable(FALSE);
-      }
-    };
-
-    if ($query->execute()->fetchField()) {
-      return $set_cacheability(AccessResult::allowed());
+    if ($operation === 'view') {
+      return $access_result->addCacheContexts(['cache_context.node_view_grants']);
     }
     else {
-      return $set_cacheability(AccessResult::forbidden());
+      return $access_result->setCacheable(FALSE);
     }
   }
 
@@ -116,7 +108,7 @@ public function access(NodeInterface $node, $operation, $langcode, AccountInterf
    */
   public function checkAll(AccountInterface $account) {
     $query = $this->database->select('node_access');
-    $query->addExpression('COUNT(*)');
+    $query->addExpression('1');
     $query
       ->condition('nid', 0)
       ->condition('grant_view', 1, '>=');
@@ -126,7 +118,7 @@ public function checkAll(AccountInterface $account) {
     if (count($grants) > 0 ) {
       $query->condition($grants);
     }
-    return $query->execute()->fetchField();
+    return (int) $query->execute()->fetchField();
   }
 
   /**
diff --git a/core/modules/node/src/NodeGrantDatabaseStorageInterface.php b/core/modules/node/src/NodeGrantDatabaseStorageInterface.php
index e865387..cea89af 100644
--- a/core/modules/node/src/NodeGrantDatabaseStorageInterface.php
+++ b/core/modules/node/src/NodeGrantDatabaseStorageInterface.php
@@ -15,14 +15,16 @@
 interface NodeGrantDatabaseStorageInterface {
 
   /**
-   * Checks all grants for a given account.
+   * Checks for a "view all" grant for a given account.
    *
    * @param \Drupal\Core\Session\AccountInterface $account
    *   A user object representing the user for whom the operation is to be
    *   performed.
    *
    * @return int.
-   *   Status of the access check.
+   *   1 if the user has the "view all" grant, 0 if not.
+   *
+   * @see hook_node_grants()
    */
   public function checkAll(AccountInterface $account);
 
@@ -44,9 +46,6 @@ public function checkAll(AccountInterface $account);
    *   performed.
    * @param string $base_table
    *   The base table of the query.
-   *
-   * @return int
-   *   Status of the access check.
    */
   public function alterQuery($query, array $tables, $op, AccountInterface $account, $base_table);
 
