Re: [PATCH V5 01/13] _check_xfs_filesystem: sync fs before running scrub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 08, 2021 at 09:20:59PM +0530, Chandan Babu R wrote:
> Tests can create a scenario in which a call to syncfs() issued at the end of
> the execution of the test script would return an error code. xfs_scrub
> internally calls syncfs() before starting the actual online consistency check
> operation. Since this call to syncfs() fails, xfs_scrub ends up returning
> without performing consistency checks on the test filesystem. This can mask a
> possible on-disk data structure corruption.

This explanation for why we're calling syncfs before invoking scrub
ought to be captured in a comment preceeding the syncfs call.

--D

> To fix the above stated problem, this commit invokes syncfs() prior to
> executing xfs_scrub.
> 
> Suggested-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> Signed-off-by: Chandan Babu R <chandanrlinux@xxxxxxxxx>
> ---
>  common/xfs | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 2156749d..7ec89492 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -467,6 +467,7 @@ _check_xfs_filesystem()
>  	# Run online scrub if we can.
>  	mntpt="$(_is_dev_mounted $device)"
>  	if [ -n "$mntpt" ] && _supports_xfs_scrub "$mntpt" "$device"; then
> +		$XFS_IO_PROG -c syncfs $mntpt >> $seqres.full 2>&1
>  		"$XFS_SCRUB_PROG" $scrubflag -v -d -n $mntpt > $tmp.scrub 2>&1
>  		if [ $? -ne 0 ]; then
>  			_log_err "_check_xfs_filesystem: filesystem on $device failed scrub"
> -- 
> 2.29.2
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux