xfs
[Top] [All Lists]

Re: [PATCH] Btrfs: add regression test for running snapshot and send con

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] Btrfs: add regression test for running snapshot and send concurrently
From: Wang Shilong <wangshilong1991@xxxxxxxxx>
Date: Thu, 6 Feb 2014 21:12:51 +0800
Cc: xfs@xxxxxxxxxxx, jbacik@xxxxxx, linux-btrfs@xxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=acolfxkNTpRsJHRkK80TZQ/COkWaPdU/NOR6eP+u028=; b=OuwSJuMQ2zASPCRRgP/WJc3v7djppASQP6KNqZPsM6F5auK+es12DCTNL5KbrhTbCr VGOGLaXAmmCrAD8qzaHBZtS5K0PVl2K2GvzWdjBDpvhIThHKmWl6qEmdKcwJ65gYIL6d Z+0bX2lCZwXwiJ+wUOwN3PbhPudUqUcEKaxSyA/PPOjS7yegmdm5/v9+SWDr9QEMasng Oa6ST3Ay4XPHng+ZrQI1lbV1q2Kcr2mAGMSeI+OhcFJBaMNJ/D4kGgP5I28toFUGBHk6 58yoYlMs4ySbf6PdPMtIM/q2EkMT6p2qTYhgbsLq/FXOrOrINVtx9Rmv2Tk7oiSllvrn hPaQ==
In-reply-to: <20140203234212.GW13997@dastard>
References: <1391440956-31924-1-git-send-email-wangshilong1991@xxxxxxxxx> <20140203234212.GW13997@dastard>
Hi Dave,

> On Mon, Feb 03, 2014 at 11:22:36PM +0800, Wang Shilong wrote:
>> From: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
>> 
>> Btrfs would fail to send if snapshot run concurrently, this test is to make
>> sure we have fixed the bug.
>> 
> Couple of comments below.
> 
>> +_scratch_mkfs > /dev/null 2>&1
>> +_scratch_mount
>> +
>> +
>> +touch $SCRATCH_MNT/foo
>> +
>> +# get file with fragments by using backwards writes.
>> +for i in `seq 10240 -1 1`; do
>> +    $XFS_IO_PROG -f -d -c "pwrite $(($i * 4096)) 4096" \
>> +    $SCRATCH_MNT/foo > /dev/null | _filter_xfs_io
> 
> Indentation.
> 
>> +done
>> +
>> +$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
>> +    $SCRATCH_MNT/snap_1 >> $seqres.full 2>&1
>> +
>> +$BTRFS_UTIL_PROG send -f $SCRATCH_MNT/send_file \
>> +    $SCRATCH_MNT/snap_1 >> $seqres.full 2>&1 &
>> +
>> +pid=$!
>> +
>> +$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT/snap_1 \
>> +    $SCRATCH_MNT/snap_2 >> $seqres.full 2>&1
>> +
>> +wait $pid || echo "Failed to send, see dmesg"
> 
> This seems kind of racy. It assumes that the send command
> doesn't complete before the wait $pid call is made. If $pid doesn't
> exist at this time because it has completed, wait will return 127
> and the test will fail….

Sorry for delay reply!

Maybe a better idea for this will be:

Opposite to previous way, we do snapshots background while at the
same time we do sending.

And btrfs-progs should output meaningful information on send failure, i will
make a tiny patch to address this issue. but to make this test more friendly, i
think we can still do something like:

btrfs send <..>  || echo "Failed to send"

What do you think of this way?  Feel free to tell me if there are better 
ideas^_^.

Thanks,
Wang
> Also, why would a failure to send result in meaingful information in
> dmesg? Shouldn't the userspace command output information to tell
> you why there was a failure into $seqres.full?
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>