]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfs: fix transient reference count error in xfs_buf_resubmit_failed_buffers
authorDave Chinner <dchinner@redhat.com>
Mon, 4 Feb 2019 16:54:23 +0000 (08:54 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit3a917bf2c82058152364ab583ef00babb19e2671
tree65b4368ebb5008a27e1ec37dd3045c29ca40f94e
parent32eaf569b15845d8f57f228fed9858bdd5738c47
xfs: fix transient reference count error in xfs_buf_resubmit_failed_buffers

BugLink: https://bugs.launchpad.net/bugs/1837664
commit d43aaf1685aa471f0593685c9f54d53e3af3cf3f upstream.

When retrying a failed inode or dquot buffer,
xfs_buf_resubmit_failed_buffers() clears all the failed flags from
the inde/dquot log items. In doing so, it also drops all the
reference counts on the buffer that the failed log items hold. This
means it can drop all the active references on the buffer and hence
free the buffer before it queues it for write again.

Putting the buffer on the delwri queue takes a reference to the
buffer (so that it hangs around until it has been written and
completed), but this goes bang if the buffer has already been freed.

Hence we need to add the buffer to the delwri queue before we remove
the failed flags from the log items attached to the buffer to ensure
it always remains referenced during the resubmit process.

Reported-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Dave Chinner <dchinner@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: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/xfs/xfs_buf_item.c