diff options
author | Brian Foster <bfoster@redhat.com> | 2017-06-24 10:11:41 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-06-24 10:11:41 -0700 |
commit | 39775431f82f890f4aaa08860a30883d081bffc7 (patch) | |
tree | b203fbdf900526c317dcf0ff7aaf928a610f017e /fs/xfs/xfs_inode.h | |
parent | 61d819e7bcb7f33da710bf3f5dcb2bcf1e48203c (diff) | |
download | linux-39775431f82f890f4aaa08860a30883d081bffc7.tar.gz linux-39775431f82f890f4aaa08860a30883d081bffc7.tar.bz2 linux-39775431f82f890f4aaa08860a30883d081bffc7.zip |
xfs: free uncommitted transactions during log recovery
Log recovery allocates in-core transaction and member item data
structures on-demand as it processes the on-disk log. Transactions
are allocated on first encounter on-disk and stored in a hash table
structure where they are easily accessible for subsequent lookups.
Transaction items are also allocated on demand and are attached to
the associated transactions.
When a commit record is encountered in the log, the transaction is
committed to the fs and the in-core structures are freed. If a
filesystem crashes or shuts down before all in-core log buffers are
flushed to the log, however, not all transactions may have commit
records in the log. As expected, the modifications in such an
incomplete transaction are not replayed to the fs. The in-core data
structures for the partial transaction are never freed, however,
resulting in a memory leak.
Update xlog_do_recovery_pass() to first correctly initialize the
hash table array so empty lists can be distinguished from populated
lists on function exit. Update xlog_recover_free_trans() to always
remove the transaction from the list prior to freeing the associated
memory. Finally, walk the hash table of transaction lists as the
last step before it goes out of scope and free any transactions that
may remain on the lists. This prevents a memory leak of partial
transactions in the log.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_inode.h')
0 files changed, 0 insertions, 0 deletions