Before this patch set, several gfs2 functions failed to reserve enough
revoke entries in the journal. Some examples:

1. gfs2_dinode_dealloc failed to reserve a revoke for the dinode
   being deleted.
2. Any function that allocates dinodes with gfs2_alloc_blocks
   should reserve a revoke because alloc_blocks will premptively
   call trans_remove_revoke to make sure there isn't a pending revoke
   for the new dinode.
3. Any function that potentially will unstuff a stuffed directory
   needs to reserve a revoke because gfs2_unstuff_dinode calls
   gfs2_trans_remove_revoke for the new journaled leaf block.

In addition, function gfs2_trans_remove_revoke unconditionally
decrements tr->tr_num_revoke, and if not enough revokes are reserved, the
value goes from 0 to  4294967295 (-1, but it's an unsigned int). This is later
re-added to the system-wide revoke numbers, thereby decrementing the value
(sd_log_commited_revoke) "properly," but by accident. This worked properly
most of the time because one transaction would reserve space for revokes,
then it would be merged with the system transaction (sdp->sd_log_tr) and it
usually did not run out, because you can hold a lot of revoke entries
per log descriptor block. Some of the code, such as gfs2_write_revokes, would
work around this and somehow got it right most of the time. However, some
jdata tests with xfstests generic/269 encountered problems when it actually
ran out.

This series adds needed revoke entries to the transactions that
need them. So now we try to do proper accounting of revokes.

Bob Peterson (6):
  gfs2: revoke cleanup: leaf_dealloc
  gfs2: revoke cleanup: alloc_dinode and gfs2_create_inode
  gfs2: revoke cleanup: gfs2_dinode_dealloc
  gfs2: revoke cleanup: gfs2_iomap_begin_write
  gfs2: revoke cleanup: truncate functions
  gfs2: revoke cleanup: gfs2_trans_remove_revoke

 fs/gfs2/bmap.c  | 25 +++++++++++++------------
 fs/gfs2/dir.c   |  3 ++-
 fs/gfs2/inode.c |  5 +++--
 fs/gfs2/super.c |  2 +-
 fs/gfs2/trans.c | 16 ++++++++++++++--
 5 files changed, 33 insertions(+), 18 deletions(-)

-- 
2.24.1

Reply via email to