From mboxrd@z Thu Jan 1 00:00:00 1970 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 A072F1E5020; Thu, 30 Jan 2025 14:30:11 +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=1738247411; cv=none; b=ETDh46ZqsiuEPh2ra/f+Ff1dngMoY33313L/206ogGZN+7L3/G+orqPW6cCWzbCJTm21PEuGzWyU7Vs0ni6j5J7rxvBnSgkOczwabodynOIe4ZqCkW+xqh7gzKBdAc48AbMoFN6+Tq0s/jlZaYAV1eVyL14fAz3QEz9I3a3dpdA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738247411; c=relaxed/simple; bh=oSYPb7YAzlGluMW+4A0UggJun5y/7/jQIhWx6Gf/a24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RRdj5uGuoHP53HTniMSQ/Br+z/eGM36uG9+rvdtc93+rqGph3LEgNS6mG2TevzXTwV+pAlcw7CSVPl0ooHs2fMeWVXl7caW5hYIYaB2Sqf6C3o+ot/MqEznL2bJE0PU96edS4XE0rE6ROXqzOMmqctLGtj+SFR5iv3gcl4Z6d5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=urZ9bSvY; 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="urZ9bSvY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AACE3C4CEE0; Thu, 30 Jan 2025 14:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738247411; bh=oSYPb7YAzlGluMW+4A0UggJun5y/7/jQIhWx6Gf/a24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urZ9bSvY5XgRXR2c1AdKs/h1PCd4IqSP1QAW0+gaLQq6mHLd7kwndDCcj7h4qvJ5d Y6ClWH3v0T8ATNYNRvzZNY5+CdiTl4FPcsmgYUsCGxg6wWDtF5U25GzNxu9mb2mjY8 h6su11yHIVhZWD8eHNJSUtoRklQzkU2y62ne50Pc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , "Darrick J. Wong" , Christian Brauner , Leah Rumancik Subject: [PATCH 6.1 30/49] xfs: respect the stable writes flag on the RT device Date: Thu, 30 Jan 2025 15:02:06 +0100 Message-ID: <20250130140135.047392030@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250130140133.825446496@linuxfoundation.org> References: <20250130140133.825446496@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christoph Hellwig [ Upstream commit 9c04138414c00ae61421f36ada002712c4bac94a ] Update the per-folio stable writes flag dependening on which device an inode resides on. Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20231025141020.192413-5-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_inode.h | 8 ++++++++ fs/xfs/xfs_ioctl.c | 8 ++++++++ fs/xfs/xfs_iops.c | 7 +++++++ 3 files changed, 23 insertions(+) --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -569,6 +569,14 @@ extern void xfs_setup_inode(struct xfs_i extern void xfs_setup_iops(struct xfs_inode *ip); extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init); +static inline void xfs_update_stable_writes(struct xfs_inode *ip) +{ + if (bdev_stable_writes(xfs_inode_buftarg(ip)->bt_bdev)) + mapping_set_stable_writes(VFS_I(ip)->i_mapping); + else + mapping_clear_stable_writes(VFS_I(ip)->i_mapping); +} + /* * When setting up a newly allocated inode, we need to call * xfs_finish_inode_setup() once the inode is fully instantiated at --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1153,6 +1153,14 @@ xfs_ioctl_setattr_xflags( ip->i_diflags2 = i_flags2; xfs_diflags_to_iflags(ip, false); + + /* + * Make the stable writes flag match that of the device the inode + * resides on when flipping the RT flag. + */ + if (rtflag != XFS_IS_REALTIME_INODE(ip) && S_ISREG(VFS_I(ip)->i_mode)) + xfs_update_stable_writes(ip); + xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); XFS_STATS_INC(mp, xs_ig_attrchg); --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1292,6 +1292,13 @@ xfs_setup_inode( mapping_set_gfp_mask(inode->i_mapping, (gfp_mask & ~(__GFP_FS))); /* + * For real-time inodes update the stable write flags to that of the RT + * device instead of the data device. + */ + if (S_ISREG(inode->i_mode) && XFS_IS_REALTIME_INODE(ip)) + xfs_update_stable_writes(ip); + + /* * If there is no attribute fork no ACL can exist on this inode, * and it can't have any file capabilities attached to it either. */