jbd: fix the way the b_modified flag is cleared
[safe/jmp/linux-2.6] / fs / jbd / transaction.c
index 2c9e8f5..2e9670e 100644 (file)
@@ -609,6 +609,12 @@ repeat:
                goto done;
 
        /*
+        * this is the first time this transaction is touching this buffer,
+        * reset the modified flag
+        */
+       jh->b_modified = 0;
+
+       /*
         * If there is already a copy-out version of this buffer, then we don't
         * need to make another one
         */
@@ -820,9 +826,16 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh)
 
        if (jh->b_transaction == NULL) {
                jh->b_transaction = transaction;
+
+               /* first access by this transaction */
+               jh->b_modified = 0;
+
                JBUFFER_TRACE(jh, "file as BJ_Reserved");
                __journal_file_buffer(jh, transaction, BJ_Reserved);
        } else if (jh->b_transaction == journal->j_committing_transaction) {
+               /* first access by this transaction */
+               jh->b_modified = 0;
+
                JBUFFER_TRACE(jh, "set next transaction");
                jh->b_next_transaction = transaction;
        }