Skip to content
  • Darrick J. Wong's avatar
    81ed9475
    xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes · 81ed9475
    Darrick J. Wong authored
    
    
    During regular operation, the xfs_inactive operations create
    transactions with zero block reservation because in general we're
    freeing space, not asking for more.  The per-AG space reservations
    created at mount time enable us to handle expansions of the refcount
    btree without needing to reserve blocks to the transaction.
    
    Unfortunately, log recovery doesn't create the per-AG space reservations
    when intent items are being recovered.  This isn't an issue for intent
    item recovery itself because they explicitly request blocks, but any
    inode inactivation that can happen during log recovery uses the same
    xfs_inactive paths as regular runtime.  If a refcount btree expansion
    happens, the transaction will fail due to blk_res_used > blk_res, and we
    shut down the filesystem unnecessarily.
    
    Fix this problem by making per-AG reservations temporarily so that we
    can handle the inactivations, and releasing them at the end.  This
    brings the recovery environment closer to the runtime environment.
    
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    81ed9475
    xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes
    Darrick J. Wong authored
    
    
    During regular operation, the xfs_inactive operations create
    transactions with zero block reservation because in general we're
    freeing space, not asking for more.  The per-AG space reservations
    created at mount time enable us to handle expansions of the refcount
    btree without needing to reserve blocks to the transaction.
    
    Unfortunately, log recovery doesn't create the per-AG space reservations
    when intent items are being recovered.  This isn't an issue for intent
    item recovery itself because they explicitly request blocks, but any
    inode inactivation that can happen during log recovery uses the same
    xfs_inactive paths as regular runtime.  If a refcount btree expansion
    happens, the transaction will fail due to blk_res_used > blk_res, and we
    shut down the filesystem unnecessarily.
    
    Fix this problem by making per-AG reservations temporarily so that we
    can handle the inactivations, and releasing them at the end.  This
    brings the recovery environment closer to the runtime environment.
    
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Loading