]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/jbd2/checkpoint.c
jbd2: jbd2_log_wait_for_space improve error detetcion
[mirror_ubuntu-bionic-kernel.git] / fs / jbd2 / checkpoint.c
index 90d6091d7e187e2b77c6776764f8df9e2ef7560b..1fbf59938cc0f71cefcddebf3e36650bfcf36dd5 100644 (file)
@@ -115,8 +115,6 @@ void __jbd2_log_wait_for_space(journal_t *journal)
 
        nblocks = jbd2_space_needed(journal);
        while (jbd2_log_space_left(journal) < nblocks) {
-               if (journal->j_flags & JBD2_ABORT)
-                       return;
                write_unlock(&journal->j_state_lock);
                mutex_lock(&journal->j_checkpoint_mutex);
 
@@ -132,6 +130,10 @@ void __jbd2_log_wait_for_space(journal_t *journal)
                 * trace for forensic evidence.
                 */
                write_lock(&journal->j_state_lock);
+               if (journal->j_flags & JBD2_ABORT) {
+                       mutex_unlock(&journal->j_checkpoint_mutex);
+                       return;
+               }
                spin_lock(&journal->j_list_lock);
                nblocks = jbd2_space_needed(journal);
                space_left = jbd2_log_space_left(journal);
@@ -285,9 +287,10 @@ restart:
                        if (unlikely(buffer_write_io_error(bh)) && !result)
                                result = -EIO;
                        BUFFER_TRACE(bh, "remove from checkpoint");
-                       __jbd2_journal_remove_checkpoint(jh);
-                       spin_unlock(&journal->j_list_lock);
-                       goto retry;
+                       if (__jbd2_journal_remove_checkpoint(jh))
+                               /* The transaction was released; we're done */
+                               goto out;
+                       continue;
                }
                /*
                 * Important: we are about to write the buffer, and