jbd2: drop checkpoint mutex when waiting in __jbd2_log_wait_for_space()
[firefly-linux-kernel-4.4.55.git] / fs / jbd2 / checkpoint.c
index 75a15f371b00c6e19a5e953e25b68be0ea391f03..7f34f4716165311f66b62b81dd25a32e899dcf80 100644 (file)
@@ -156,7 +156,15 @@ void __jbd2_log_wait_for_space(journal_t *journal)
                                /* We were able to recover space; yay! */
                                ;
                        } else if (tid) {
+                               /*
+                                * jbd2_journal_commit_transaction() may want
+                                * to take the checkpoint_mutex if JBD2_FLUSHED
+                                * is set.  So we need to temporarily drop it.
+                                */
+                               mutex_unlock(&journal->j_checkpoint_mutex);
                                jbd2_log_wait_commit(journal, tid);
+                               write_lock(&journal->j_state_lock);
+                               continue;
                        } else {
                                printk(KERN_ERR "%s: needed %d blocks and "
                                       "only had %d space available\n",