xfs: clean up after failed metafile relinking
Once we start a metadir update to link in a file, we have to commit or cancel it, just like any other operation. LOLLM pointed out that I forgot that, so fix it. This fixes a bug in xfs_repair. However, in commit e80fbe1ad8eff7, we made xfs_metadir_cancel a static function within xfs_metadir.c, so we can't just add a xfs_metadir_cancel call to xfs_dqinode_metadir_link. Instead, create a new xfs_metadir_link_file helper in xfs_metadir.c that takes only the xfs_metadir_update object, and handles everything from start to finish. This enables us to make xfs_metadir_commit a static function too. Fixes: e80fbe1ad8eff7 ("xfs: use metadir for quota inodes") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>