Skip to content
  • Jan Kara's avatar
    jbd2: avoid leaking transaction credits when unreserving handle · 14ff6286
    Jan Kara authored
    When reserved transaction handle is unused, we subtract its reserved
    credits in __jbd2_journal_unreserve_handle() called from
    jbd2_journal_stop(). However this function forgets to remove reserved
    credits from transaction->t_outstanding_credits and thus the transaction
    space that was reserved remains effectively leaked. The leaked
    transaction space can be quite significant in some cases and leads to
    unnecessarily small transactions and thus reducing throughput of the
    journalling machinery. E.g. fsmark workload creating lots of 4k files
    was observed to have about 20% lower throughput due to this when ext4 is
    mounted with dioread_nolock mount option.
    
    Subtract reserved credits from t_outstanding_credits as well.
    
    CC: stable@vger.kernel.org
    Fixes: 8f7d89f3
    
     ("jbd2: transaction reservation support")
    Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20200520133119.1383-3-jack@suse.cz
    
    
    Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    14ff6286