| From foo@baz Wed Oct 26 04:49:40 PM CEST 2022 |
| From: Chandan Babu R <chandan.babu@oracle.com> |
| Date: Wed, 26 Oct 2022 11:58:41 +0530 |
| Subject: xfs: reflink should force the log out if mounted with wsync |
| To: gregkh@linuxfoundation.org |
| Cc: sashal@kernel.org, mcgrof@kernel.org, linux-xfs@vger.kernel.org, stable@vger.kernel.org, djwong@kernel.org, chandan.babu@oracle.com, amir73il@gmail.com, leah.rumancik@gmail.com |
| Message-ID: <20221026062843.927600-25-chandan.babu@oracle.com> |
| |
| From: Christoph Hellwig <hch@lst.de> |
| |
| commit 5833112df7e9a306af9af09c60127b92ed723962 upstream. |
| |
| Reflink should force the log out to disk if the filesystem was mounted |
| with wsync, the same as most other operations in xfs. |
| |
| [Note: XFS_MOUNT_WSYNC is set when the admin mounts the filesystem |
| with either the 'wsync' or 'sync' mount options, which effectively means |
| that we're classifying reflink/dedupe as IO operations and making them |
| synchronous when required.] |
| |
| Fixes: 3fc9f5e409319 ("xfs: remove xfs_reflink_remap_range") |
| Signed-off-by: Christoph Hellwig <hch@lst.de> |
| Reviewed-by: Brian Foster <bfoster@redhat.com> |
| [darrick: add more to the changelog] |
| Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> |
| Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> |
| Acked-by: Darrick J. Wong <djwong@kernel.org> |
| Signed-off-by: Chandan Babu R <chandan.babu@oracle.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| fs/xfs/xfs_file.c | 4 ++++ |
| 1 file changed, 4 insertions(+) |
| |
| --- a/fs/xfs/xfs_file.c |
| +++ b/fs/xfs/xfs_file.c |
| @@ -1044,7 +1044,11 @@ xfs_file_remap_range( |
| |
| ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize, |
| remap_flags); |
| + if (ret) |
| + goto out_unlock; |
| |
| + if (mp->m_flags & XFS_MOUNT_WSYNC) |
| + xfs_log_force_inode(dest); |
| out_unlock: |
| xfs_reflink_remap_unlock(file_in, file_out); |
| if (ret) |