]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/jbd2/revoke.c
jbd2: Reserve space for revoke descriptor blocks
[linux.git] / fs / jbd2 / revoke.c
index f08073d7bbf57d975a1f85957b39ef497f1a38aa..fa608788b93d7c55977b8c64201374ffb6a1a42c 100644 (file)
@@ -371,6 +371,11 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
        }
 #endif
 
+       if (WARN_ON_ONCE(handle->h_revoke_credits <= 0)) {
+               if (!bh_in)
+                       brelse(bh);
+               return -EIO;
+       }
        /* We really ought not ever to revoke twice in a row without
            first having the revoke cancelled: it's illegal to free a
            block twice without allocating it in between! */
@@ -391,6 +396,7 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
                        __brelse(bh);
                }
        }
+       handle->h_revoke_credits--;
 
        jbd_debug(2, "insert revoke for block %llu, bh_in=%p\n",blocknr, bh_in);
        err = insert_revoke_hash(journal, blocknr,