[PATCH 5/6] xfs: don't modify file attributes or poke fsnotify for dry runs

"Darrick J. Wong" <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.stable
Message-ID <178659861983.833922.10991178975977666480.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <[email protected]>

LOLLM points out that a dry run shouldn't poke fsnotify because we don't
actually change the files.  I noticed that we also shouldn't be removing
file privileges when doing a dry run.

Cc: <[email protected]> # v6.10
Fixes: 42672471f938cd ("xfs: bind together the front and back ends of the file range exchange code")
Signed-off-by: "Darrick J. Wong" <[email protected]>
Assisted-by: LOLLM # finding obvious bugs
---
 fs/xfs/xfs_exchrange.c |    6 ++++++
 1 file changed, 6 insertions(+)


diff --git a/fs/xfs/xfs_exchrange.c b/fs/xfs/xfs_exchrange.c
index 94965a6c2187ff..56f9a6b47c47b0 100644
--- a/fs/xfs/xfs_exchrange.c
+++ b/fs/xfs/xfs_exchrange.c
@@ -701,6 +701,9 @@ xfs_exchrange_contents(
 	if (error)
 		goto out_unlock;
 
+	if (fxr->flags & XFS_EXCHANGE_RANGE_DRY_RUN)
+		goto out_unlock;
+
 	/*
 	 * Finish the exchange by removing special file privileges like any
 	 * other file write would do.  This may involve turning on support for
@@ -783,6 +786,9 @@ xfs_exchange_range(
 	if (ret)
 		return ret;
 
+	if (fxr->flags & XFS_EXCHANGE_RANGE_DRY_RUN)
+		return 0;
+
 	fsnotify_modify(fxr->file1);
 	if (fxr->file2 != fxr->file1)
 		fsnotify_modify(fxr->file2);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.