diff mbox series

btrfs-progs: mkfs: check blkid version

Message ID 20230116030853.3606361-1-naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: mkfs: check blkid version | expand

Commit Message

Naohiro Aota Jan. 16, 2023, 3:08 a.m. UTC
Prior to libblkid-2.38, it fails to detect zoned mode's superblock location
and cause "blkid" to fail to detect btrfs properly. This patch suggets to
upgrade libblkid if it detects <libblkid-2.38.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 mkfs/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Johannes Thumshirn Jan. 16, 2023, 7:24 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Damien Le Moal Jan. 16, 2023, 12:29 p.m. UTC | #2
On 1/16/23 12:08, Naohiro Aota wrote:
> Prior to libblkid-2.38, it fails to detect zoned mode's superblock location

Prior to version 2.38, libblkid fails to...

> and cause "blkid" to fail to detect btrfs properly. This patch suggets to

resulting in blkid failing to detect btrfs on zoned block devices. This
patch suggest to the user to upgrade libblkid if it detects a version
lower then 2.38.

Would be better :)

> upgrade libblkid if it detects <libblkid-2.38.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>  mkfs/main.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/mkfs/main.c b/mkfs/main.c
> index df091b16760c..e0cb6a8c2bff 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -28,6 +28,7 @@
>  #include <string.h>
>  #include <pthread.h>
>  #include <uuid/uuid.h>
> +#include <blkid/blkid.h>
>  #include "kernel-lib/list.h"
>  #include "kernel-lib/list_sort.h"
>  #include "kernel-lib/rbtree.h"
> @@ -1346,6 +1347,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>  		exit(1);
>  	}
>  	if (opt_zoned) {
> +		const int blkid_version =  blkid_get_library_version(NULL, NULL);
> +
>  		if (source_dir_set) {
>  			error("the option -r and zoned mode are incompatible");
>  			exit(1);
> @@ -1360,6 +1363,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>  			error("cannot enable RAID5/6 in zoned mode");
>  			exit(1);
>  		}
> +
> +		if (blkid_version < 2380)
> +			warning("libblkid < 2.38 does not support zoned mode's superblock location, update recommended");
>  	}
>  
>  	if (btrfs_check_nodesize(nodesize, sectorsize, &features))
David Sterba Jan. 17, 2023, 3:18 p.m. UTC | #3
On Mon, Jan 16, 2023 at 12:08:53PM +0900, Naohiro Aota wrote:
> Prior to libblkid-2.38, it fails to detect zoned mode's superblock location
> and cause "blkid" to fail to detect btrfs properly. This patch suggets to
> upgrade libblkid if it detects <libblkid-2.38.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Added to devel, changelog replaced by Damien's text, thanks.
diff mbox series

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index df091b16760c..e0cb6a8c2bff 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -28,6 +28,7 @@ 
 #include <string.h>
 #include <pthread.h>
 #include <uuid/uuid.h>
+#include <blkid/blkid.h>
 #include "kernel-lib/list.h"
 #include "kernel-lib/list_sort.h"
 #include "kernel-lib/rbtree.h"
@@ -1346,6 +1347,8 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 		exit(1);
 	}
 	if (opt_zoned) {
+		const int blkid_version =  blkid_get_library_version(NULL, NULL);
+
 		if (source_dir_set) {
 			error("the option -r and zoned mode are incompatible");
 			exit(1);
@@ -1360,6 +1363,9 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 			error("cannot enable RAID5/6 in zoned mode");
 			exit(1);
 		}
+
+		if (blkid_version < 2380)
+			warning("libblkid < 2.38 does not support zoned mode's superblock location, update recommended");
 	}
 
 	if (btrfs_check_nodesize(nodesize, sectorsize, &features))