[PATCH] btrfs-porgs: fix xfstest btrfs/023 random failure

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

 



xfstest btrfs/023 which does the following tests

create_group_profile "raid0"
check_group_profile "RAID0"

create_group_profile "raid1"
check_group_profile "RAID1"

create_group_profile "raid10"
check_group_profile "RAID10"

create_group_profile "raid5"
check_group_profile "RAID5"

create_group_profile "raid6"
check_group_profile "RAID6"

fails randomly with the error as below

 ERROR: device scan failed '/dev/sde' - Invalid argument

since failure is at random group profile it indicates to me that
btrfs kernel did not see the newly created btrfs on the device

To note: I have the following patch on the kernel which
is not yet integrated, but its not related to this bug.

btrfs: RFC: code optimize use btrfs_get_bdev_and_sb() at btrfs_scan_one_device
btrfs: looping 'mkfs.btrfs -f <dev>' may fail with EBUSY
btrfs: check generation as replace duplicates devid+uuid

This patch calls fsync() at btrfs_prepare_device().

With this btrfs/023 has NOT failed consistently for several long
iterations.

Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
 utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils.c b/utils.c
index fbc5bde..e144dfd 100644
--- a/utils.c
+++ b/utils.c
@@ -741,6 +741,8 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
 	}
 	*block_count_ret = block_count;
 
+	fsync(fd);
+
 zero_dev_error:
 	if (ret < 0) {
 		fprintf(stderr, "ERROR: failed to zero device '%s' - %s\n",
-- 
2.0.0.153.g79dcccc

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux