]> Git Repo - linux.git/blobdiff - fs/jbd/commit.c
selinux: Remove security_ops extern
[linux.git] / fs / jbd / commit.c
index 86b39b167c23645261ae2b3a0a248711a1f33122..bb217dcb41affbcca6b42e7c5b018a72e0a3aed0 100644 (file)
@@ -162,8 +162,17 @@ static void journal_do_submit_data(struct buffer_head **wbuf, int bufs,
 
        for (i = 0; i < bufs; i++) {
                wbuf[i]->b_end_io = end_buffer_write_sync;
-               /* We use-up our safety reference in submit_bh() */
-               submit_bh(write_op, wbuf[i]);
+               /*
+                * Here we write back pagecache data that may be mmaped. Since
+                * we cannot afford to clean the page and set PageWriteback
+                * here due to lock ordering (page lock ranks above transaction
+                * start), the data can change while IO is in flight. Tell the
+                * block layer it should bounce the bio pages if stable data
+                * during write is required.
+                *
+                * We use up our safety reference in submit_bh().
+                */
+               _submit_bh(write_op, wbuf[i], 1 << BIO_SNAP_STABLE);
        }
 }
 
@@ -331,13 +340,13 @@ void journal_commit_transaction(journal_t *journal)
        J_ASSERT(journal->j_committing_transaction == NULL);
 
        commit_transaction = journal->j_running_transaction;
-       J_ASSERT(commit_transaction->t_state == T_RUNNING);
 
        trace_jbd_start_commit(journal, commit_transaction);
        jbd_debug(1, "JBD: starting commit of transaction %d\n",
                        commit_transaction->t_tid);
 
        spin_lock(&journal->j_state_lock);
+       J_ASSERT(commit_transaction->t_state == T_RUNNING);
        commit_transaction->t_state = T_LOCKED;
 
        trace_jbd_commit_locking(journal, commit_transaction);
@@ -667,7 +676,17 @@ start_journal_io:
                                clear_buffer_dirty(bh);
                                set_buffer_uptodate(bh);
                                bh->b_end_io = journal_end_buffer_io_sync;
-                               submit_bh(write_op, bh);
+                               /*
+                                * In data=journal mode, here we can end up
+                                * writing pagecache data that might be
+                                * mmapped. Since we can't afford to clean the
+                                * page and set PageWriteback (see the comment
+                                * near the other use of _submit_bh()), the
+                                * data can change while the write is in
+                                * flight.  Tell the block layer to bounce the
+                                * bio pages if stable pages are required.
+                                */
+                               _submit_bh(write_op, bh, 1 << BIO_SNAP_STABLE);
                        }
                        cond_resched();
 
This page took 0.033303 seconds and 4 git commands to generate.