]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: allow null firstblock in xfs_bmapi_write() when tp is null
authorBrian Foster <bfoster@redhat.com>
Thu, 4 Oct 2018 19:40:01 +0000 (14:40 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 4 Oct 2018 19:40:01 +0000 (14:40 -0500)
commit78f7b3f185881bcfa97c64c0291bde5ee1972856
tree4941db8d8c06da68744e4508be9a1a86f34b8681
parentfe891182b62c237726414d803790d7b62cc31427
xfs: allow null firstblock in xfs_bmapi_write() when tp is null

Source kernel commit: 3ae2d89174e4ba581093320afb48421ca95191d2

xfs_bmapi_write() always expects a valid firstblock pointer. It
immediately dereferences the pointer to help determine how to
initialize the bma.minleft field. The remaining accesses are
related to modifying btree format forks, which is only relevant for
!COW fork callers.

The reflink code passes a NULL transaction to xfs_bmapi_write() in a
couple places that do COW fork unwritten conversion. The purpose of
the firstblock field is to track the first block allocation in the
current transaction, so technically firstblock should not be
required for these callers either.

Tweak xfs_bmapi_write() to initialize the bma correctly without
accessing the firstblock pointer if no transaction is provided in
the first place. Update the reflink callers to pass NULL instead of
otherwise unused firstblock references.

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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c