From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:54018 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751239AbdFEPKU (ORCPT ); Mon, 5 Jun 2017 11:10:20 -0400 Subject: Patch "xfs: xfs_trans_alloc_empty" has been added to the 4.9-stable tree To: hch@lst.de, darrick.wong@oracle.com Cc: , From: Date: Mon, 05 Jun 2017 17:08:55 +0200 In-Reply-To: <20170603131836.26661-21-hch@lst.de> Message-ID: <149667533566197@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled xfs: xfs_trans_alloc_empty to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-xfs_trans_alloc_empty.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From hch@lst.de Mon Jun 5 17:05:12 2017 From: Christoph Hellwig Date: Sat, 3 Jun 2017 15:18:31 +0200 Subject: xfs: xfs_trans_alloc_empty To: stable@vger.kernel.org Cc: linux-xfs@vger.kernel.org, "Darrick J . Wong" Message-ID: <20170603131836.26661-21-hch@lst.de> From: Christoph Hellwig This is a partial cherry-pick of commit e89c041338 ("xfs: implement the GETFSMAP ioctl"), which also adds this helper, and a great example of why feature patches should be properly split into their parts. Signed-off-by: Darrick J. Wong [hch: split from the larger patch for -stable] Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_trans.c | 22 ++++++++++++++++++++++ fs/xfs/xfs_trans.h | 2 ++ 2 files changed, 24 insertions(+) --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -263,6 +263,28 @@ xfs_trans_alloc( } /* + * Create an empty transaction with no reservation. This is a defensive + * mechanism for routines that query metadata without actually modifying + * them -- if the metadata being queried is somehow cross-linked (think a + * btree block pointer that points higher in the tree), we risk deadlock. + * However, blocks grabbed as part of a transaction can be re-grabbed. + * The verifiers will notice the corrupt block and the operation will fail + * back to userspace without deadlocking. + * + * Note the zero-length reservation; this transaction MUST be cancelled + * without any dirty data. + */ +int +xfs_trans_alloc_empty( + struct xfs_mount *mp, + struct xfs_trans **tpp) +{ + struct xfs_trans_res resv = {0}; + + return xfs_trans_alloc(mp, &resv, 0, 0, XFS_TRANS_NO_WRITECOUNT, tpp); +} + +/* * Record the indicated change to the given field for application * to the file system's superblock when the transaction commits. * For now, just store the change in the transaction structure. --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -159,6 +159,8 @@ typedef struct xfs_trans { int xfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp, uint blocks, uint rtextents, uint flags, struct xfs_trans **tpp); +int xfs_trans_alloc_empty(struct xfs_mount *mp, + struct xfs_trans **tpp); void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t); struct xfs_buf *xfs_trans_get_buf_map(struct xfs_trans *tp, Patches currently in stable-queue which might be from hch@lst.de are queue-4.9/nvme-use-blk_mq_start_hw_queues-in-nvme_kill_queues.patch queue-4.9/xfs-fix-over-copying-of-getbmap-parameters-from-userspace.patch queue-4.9/xfs-bmapx-shouldn-t-barf-on-inline-format-directories.patch queue-4.9/nvme-avoid-to-use-blk_mq_abort_requeue_list.patch queue-4.9/xfs-rework-the-inline-directory-verifiers.patch queue-4.9/nvme-rdma-support-devices-with-queue-size-32.patch queue-4.9/xfs-xfs_trans_alloc_empty.patch queue-4.9/xfs-fix-integer-truncation-in-xfs_bmap_remap_alloc.patch queue-4.9/xfs-actually-report-xattr-extents-via-iomap.patch queue-4.9/xfs-fix-use-after-free-in-xfs_finish_page_writeback.patch queue-4.9/xfs-reserve-enough-blocks-to-handle-btree-splits-when-remapping.patch queue-4.9/xfs-fix-kernel-memory-exposure-problems.patch