• Theodore Ts'o's avatar
    jbd2: invalidate handle if jbd2_journal_restart() fails · 41a5b913
    Theodore Ts'o authored
    If jbd2_journal_restart() fails the handle will have been disconnected
    from the current transaction.  In this situation, the handle must not
    be used for for any jbd2 function other than jbd2_journal_stop().
    Enforce this with by treating a handle which has a NULL transaction
    pointer as an aborted handle, and issue a kernel warning if
    jbd2_journal_extent(), jbd2_journal_get_write_access(),
    jbd2_journal_dirty_metadata(), etc. is called with an invalid handle.
    
    This commit also fixes a bug where jbd2_journal_stop() would trip over
    a kernel jbd2 assertion check when trying to free an invalid handle.
    
    Also move the responsibility of setting current->journal_info to
    start_this_handle(), simplifying the three users of this function.
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    Reported-by: default avatarYounger Liu <younger.liu@huawei.com>
    Cc: Jan Kara <jack@suse.cz>
    41a5b913
transaction.c 75 KB