Re: [PATCH v3 05/10] btrfs: check if cloned device mounts with tempfsid

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



+create_cloned_devices()
+{
+       local dev1=$1
+       local dev2=$2
+
+       [[ -z $dev1 || -z $dev2 ]] && \
+               _fail "create_cloned_devices() requires two devices as arguments"

Now that the function is not generic, in common/btrfs, and used only
once in this test, this check doesn't make that much sense anymore.


 Removed.

+
+       echo -n Creating cloned device...

Wondering why the -n here, makes the golden output a bit weird.


 Overall it limits the output to a line; organized well w.r.t the
 helper function, deciding to keep it. Thx.


+       _mkfs_dev -fq -b $((1024 * 1024 * 300)) $dev1
+
+       _mount $dev1 $SCRATCH_MNT
+
+       $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/foo | \
+                                                               _filter_xfs_io
+       $UMOUNT_PROG $SCRATCH_MNT
+       # device dump of $dev1 to $dev2
+       dd if=$dev1 of=$dev2 bs=300M count=1 conv=fsync status=none || \
+                                                       _fail "dd failed: $?"
+       echo done
+}
+
+mount_cloned_device()
+{
+       local ret

Unused variable.


 Removed.

Thanks. Anand

Thanks.

+
+       echo ---- $FUNCNAME ----
+       create_cloned_devices ${SCRATCH_DEV_NAME[0]} ${SCRATCH_DEV_NAME[1]}
+
+       echo Mounting original device
+       _mount ${SCRATCH_DEV_NAME[0]} $SCRATCH_MNT
+       $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/foo | \
+                                                               _filter_xfs_io
+       check_fsid ${SCRATCH_DEV_NAME[0]}
+
+       echo Mounting cloned device
+       _mount ${SCRATCH_DEV_NAME[1]} $mnt1 || \
+                               _fail "mount failed, tempfsid didn't work"
+
+       echo cp reflink must fail
+       _cp_reflink $SCRATCH_MNT/foo $mnt1/bar 2>&1 | \
+                                               _filter_testdir_and_scratch
+
+       check_fsid ${SCRATCH_DEV_NAME[1]}
+}
+
+mount_cloned_device
+
+_scratch_dev_pool_put
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/312.out b/tests/btrfs/312.out
new file mode 100644
index 000000000000..b7de6ce3cc6e
--- /dev/null
+++ b/tests/btrfs/312.out
@@ -0,0 +1,19 @@
+QA output created by 312
+---- mount_cloned_device ----
+Creating cloned device...wrote 9000/9000 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+done
+Mounting original device
+wrote 9000/9000 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+On disk fsid:          FSID
+Metadata uuid:         FSID
+Temp fsid:             FSID
+Tempfsid status:       0
+Mounting cloned device
+cp reflink must fail
+cp: failed to clone 'TEST_DIR/312/mnt1/bar' from 'SCRATCH_MNT/foo': Invalid cross-device link
+On disk fsid:          FSID
+Metadata uuid:         FSID
+Temp fsid:             TEMPFSID
+Tempfsid status:       1
--
2.39.3





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux