]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
jbd2: Fix buffer head leak when writing the commit block
authorTheodore Ts'o <tytso@mit.edu>
Mon, 6 Oct 2008 16:04:02 +0000 (12:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 6 Oct 2008 16:04:02 +0000 (12:04 -0400)
Also make sure the buffer heads are marked clean before submitting bh
for writing.  The previous code was marking the buffer head dirty,
which would have forced an unneeded write (and seek) to the journal
for no good reason.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/jbd2/commit.c

index e91f051a98591c8f1970cd8da566dd06e1c7364f..0d3814a35ed11e19a09beb3007113bfa067d0ecb 100644 (file)
@@ -127,8 +127,7 @@ static int journal_submit_commit_record(journal_t *journal,
 
        JBUFFER_TRACE(descriptor, "submit commit block");
        lock_buffer(bh);
-       get_bh(bh);
-       set_buffer_dirty(bh);
+       clear_buffer_dirty(bh);
        set_buffer_uptodate(bh);
        bh->b_end_io = journal_end_buffer_io_sync;
 
@@ -158,7 +157,7 @@ static int journal_submit_commit_record(journal_t *journal,
                /* And try again, without the barrier */
                lock_buffer(bh);
                set_buffer_uptodate(bh);
-               set_buffer_dirty(bh);
+               clear_buffer_dirty(bh);
                ret = submit_bh(WRITE, bh);
        }
        *cbh = bh;