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

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.stable
Message-ID <[email protected]>
On Wed, Aug 12, 2026 at 10:26:43PM -0700, Darrick J. Wong wrote:
> 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.

> +++ 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

This just skip removing the privileges.  I guess the commit mentions
this on the side, but this is probably the important part, so my
emphasis it?  It would also seem easier to move the check into
xfs_exchange_range_finish next to the code that it guards.

> @@ -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);

Move the fsnotify calls into an if statement instead of the
early return?
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.