xfs: always call xfs_update_stable_writes in xfs_ioctl_setattr_xflags
PATCH 1/1 xfs: always call xfs_update_stable_writes in xfs_ioctl_setattr_xflags
Currently xfs_update_stable_writes() is never called when the RT flag is flipped because xfs_ioctl_setattr_xflags() updates ip->i_diflags before comparing the rtflag variable to XFS_IS_REALTIME_INODE(ip), and thus the stable flag can be set incorretly when flipping the realtime bit on an existing file.
Fix this by unconditionally calling xfs_update_stable_writes for regular files.
--- fs/xfs/xfs_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_ioctl.c +1 -1
@@ -595,7 +595,7 @@ xfs_ioctl_setattr_xflags(* 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)) +if (S_ISREG (VFS_I (ip)->i_mode))xfs_update_stable_writes (ip);xfs_trans_ichgtime (tp, ip,XFS_ICHGTIME_CHG );
Signature · 1 line
2.53.0
Quoted 6 lines · Christoph Hellwig
Currently
xfs_update_stable_writes()is never called when the RT flag is flipped becausexfs_ioctl_setattr_xflags()updatesip->i_diflagsbefore comparing the rtflag variable toXFS_IS_REALTIME_INODE(ip), and thus the stable flag can be set incorretly when flipping the realtime bit on an existing file.
Quoted 6 lines
Fix this by unconditionally calling
xfs_update_stable_writesfor regular files.Fixes d528a6c1d4b6 ("xfs: data checksums require stable writes")Reported-by Wilfred Mallawa <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Quoted 21 lines
--- fs/xfs/xfs_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_ioctl.c +1
-1@@ -595,7 +595,7 @@ xfs_ioctl_setattr_xflags(* 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)) +if (S_ISREG (VFS_I (ip)->i_mode))xfs_update_stable_writes (ip);xfs_trans_ichgtime (tp, ip,XFS_ICHGTIME_CHG );Signature · 1 line
2.53.0