Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D89DA1B0422; Thu, 30 Jan 2025 08:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738226476; cv=none; b=GTcA8MVsrfwbpItcpO6mUpTi42BsnRV2P6FLe193CLlE96JCBEcDLG03juRiqTKlWQsVm65E4wpaTwAtQlrkDGFeizza9g81dvTX1vXx9YQBYuQbd5aADsw+Q6z5UWQzSn2Y0VkAhDSa8uzDxWXQD8q8sy8ScoPQedf3M17Q368= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738226476; c=relaxed/simple; bh=eWQn/So+05jCVDu5wEC3+uWX+ati/adtx7JBvfDDCgs=; h=Subject:To:Cc:From:Date:In-Reply-To:Message-ID:MIME-Version: Content-Type; b=L6JFsJSBsz3TnoN5xqmMWH55EgIZuasLJ/oAwT6It7wzregaIrNoxXFBTyG/aC/SYYTqE7W1pVxxn83Jtqog9Y5sdN/Ugf/U30GqFQinc057FsfCvF79jWU/TReoJLYix7tJwivBlpeSb1qOAS332VvIaAb8fUWptCDMfwc5Ibo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UgdQJPlW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UgdQJPlW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C69BBC4CED2; Thu, 30 Jan 2025 08:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738226476; bh=eWQn/So+05jCVDu5wEC3+uWX+ati/adtx7JBvfDDCgs=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=UgdQJPlWqRnRDSSgVLroCQbvZ0hmUbdMALAglpTWnCWCTI9u77QzD3exqErzEJuxN XzFTvFSP+0ndZWGLBfjaCGrDSEj5e2bKyqL0JUCR5qK8pzcpNgT2j1j5a0vYiDkUdK lUADSAktVMd4J0DJg9sKHKww9mL5LnXkmdjrpSwU= Subject: Patch "xfs: clean up FS_XFLAG_REALTIME handling in xfs_ioctl_setattr_xflags" has been added to the 6.1-stable tree To: amir73il@gmail.com,brauner@kernel.org,catherine.hoang@oracle.com,chandan.babu@oracle.com,djwong@kernel.org,gregkh@linuxfoundation.org,hch@lst.de,leah.rumancik@gmail.com,xfs-stable@lists.linux.dev Cc: From: Date: Thu, 30 Jan 2025 09:40:59 +0100 In-Reply-To: <20250129184717.80816-19-leah.rumancik@gmail.com> Message-ID: <2025013059-unlivable-pennant-ad90@gregkh> Precedence: bulk X-Mailing-List: xfs-stable@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore This is a note to let you know that I've just added the patch titled xfs: clean up FS_XFLAG_REALTIME handling in xfs_ioctl_setattr_xflags to the 6.1-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-clean-up-fs_xflag_realtime-handling-in-xfs_ioctl_setattr_xflags.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From stable+bounces-111230-greg=kroah.com@vger.kernel.org Wed Jan 29 19:48:03 2025 From: Leah Rumancik Date: Wed, 29 Jan 2025 10:47:16 -0800 Subject: xfs: clean up FS_XFLAG_REALTIME handling in xfs_ioctl_setattr_xflags To: stable@vger.kernel.org Cc: xfs-stable@lists.linux.dev, amir73il@gmail.com, chandan.babu@oracle.com, catherine.hoang@oracle.com, Christoph Hellwig , "Darrick J. Wong" , Christian Brauner , Leah Rumancik Message-ID: <20250129184717.80816-19-leah.rumancik@gmail.com> From: Christoph Hellwig [ Upstream commit c421df0b19430417a04f68919fc3d1943d20ac04 ] Introduce a local boolean variable if FS_XFLAG_REALTIME to make the checks for it more obvious, and de-densify a few of the conditionals using it to make them more readable while at it. Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20231025141020.192413-4-hch@lst.de Reviewed-by: Darrick J. Wong Signed-off-by: Christian Brauner Signed-off-by: Leah Rumancik Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_ioctl.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1120,23 +1120,25 @@ xfs_ioctl_setattr_xflags( struct fileattr *fa) { struct xfs_mount *mp = ip->i_mount; + bool rtflag = (fa->fsx_xflags & FS_XFLAG_REALTIME); uint64_t i_flags2; - /* Can't change realtime flag if any extents are allocated. */ - if ((ip->i_df.if_nextents || ip->i_delayed_blks) && - XFS_IS_REALTIME_INODE(ip) != (fa->fsx_xflags & FS_XFLAG_REALTIME)) - return -EINVAL; + if (rtflag != XFS_IS_REALTIME_INODE(ip)) { + /* Can't change realtime flag if any extents are allocated. */ + if (ip->i_df.if_nextents || ip->i_delayed_blks) + return -EINVAL; + } - /* If realtime flag is set then must have realtime device */ - if (fa->fsx_xflags & FS_XFLAG_REALTIME) { + if (rtflag) { + /* If realtime flag is set then must have realtime device */ if (mp->m_sb.sb_rblocks == 0 || mp->m_sb.sb_rextsize == 0 || (ip->i_extsize % mp->m_sb.sb_rextsize)) return -EINVAL; - } - /* Clear reflink if we are actually able to set the rt flag. */ - if ((fa->fsx_xflags & FS_XFLAG_REALTIME) && xfs_is_reflink_inode(ip)) - ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; + /* Clear reflink if we are actually able to set the rt flag. */ + if (xfs_is_reflink_inode(ip)) + ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; + } /* Don't allow us to set DAX mode for a reflinked file for now. */ if ((fa->fsx_xflags & FS_XFLAG_DAX) && xfs_is_reflink_inode(ip)) Patches currently in stable-queue which might be from leah.rumancik@gmail.com are queue-6.1/xfs-allow-read-io-and-ficlone-to-run-concurrently.patch queue-6.1/xfs-hoist-freeing-of-rt-data-fork-extent-mappings.patch queue-6.1/xfs-make-sure-maxlen-is-still-congruent-with-prod-when-rounding-down.patch queue-6.1/xfs-only-remap-the-written-blocks-in-xfs_reflink_end_cow_extent.patch queue-6.1/xfs-dquot-recovery-does-not-validate-the-recovered-dquot.patch queue-6.1/xfs-clean-up-dqblk-extraction.patch queue-6.1/xfs-abort-intent-items-when-recovery-intents-fail.patch queue-6.1/xfs-up-ic_sema-if-flushing-data-device-fails.patch queue-6.1/xfs-fix-internal-error-from-agfl-exhaustion.patch queue-6.1/xfs-factor-out-xfs_defer_pending_abort.patch queue-6.1/xfs-fix-units-conversion-error-in-xfs_bmap_del_extent_delay.patch queue-6.1/xfs-bump-max-fsgeom-struct-version.patch queue-6.1/xfs-handle-nimaps-0-from-xfs_bmapi_write-in-xfs_alloc_file_space.patch queue-6.1/xfs-rt-stubs-should-return-negative-errnos-when-rt-disabled.patch queue-6.1/xfs-clean-up-fs_xflag_realtime-handling-in-xfs_ioctl_setattr_xflags.patch queue-6.1/xfs-respect-the-stable-writes-flag-on-the-rt-device.patch queue-6.1/xfs-introduce-protection-for-drop-nlink.patch queue-6.1/xfs-prevent-rt-growfs-when-quota-is-enabled.patch queue-6.1/xfs-inode-recovery-does-not-validate-the-recovered-inode.patch