• Lachlan McIlroy's avatar
    [XFS] Move memory allocations for log tracing out of the critical path · 31bd61f2
    Lachlan McIlroy authored
    Memory allocations for log->l_grant_trace and iclog->ic_trace are done on
    demand when the first event is logged. In xlog_state_get_iclog_space() we
    call xlog_trace_iclog() under a spinlock and allocating memory here can
    cause us to sleep with a spinlock held and deadlock the system.
    
    For the log grant tracing we use KM_NOSLEEP but that means we can lose
    trace entries. Since there is no locking to serialize the log grant
    tracing we could race and have multiple allocations and leak memory.
    
    So move the allocations to where we initialize the log/iclog structures.
    Use KM_NOFS to avoid recursing into the filesystem and drop log->l_trace
    since it's not even used.
    
    SGI-PV: 983738
    
    SGI-Modid: xfs-linux-melb:xfs-kern:31896a
    Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
    31bd61f2
xfs_log_priv.h 17.8 KB