mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-08 00:00:12 +03:00
cmd_device: Device add now updates blkid cache
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
8868e1c2b4
commit
f4aa18bea1
@ -12,6 +12,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <blkid.h>
|
||||
|
||||
#include "libbcachefs/bcachefs.h"
|
||||
#include "libbcachefs/bcachefs_ioctl.h"
|
||||
#include "libbcachefs/errcode.h"
|
||||
@ -88,7 +90,7 @@ static int cmd_device_add(int argc, char *argv[])
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
args_shift(optind);
|
||||
|
||||
char *fs_path = arg_pop();
|
||||
@ -125,6 +127,18 @@ static int cmd_device_add(int argc, char *argv[])
|
||||
darray_exit(&devs);
|
||||
free(sb);
|
||||
bchu_disk_add(fs, dev_opts.path);
|
||||
|
||||
/* A whole bunch of nonsense to get blkid to update its cache, so
|
||||
* mount can find the new device by UUID:
|
||||
*/
|
||||
blkid_cache cache = NULL;
|
||||
if (!blkid_get_cache(&cache, NULL)) {
|
||||
blkid_dev dev = blkid_get_dev(cache, dev_opts.path, BLKID_DEV_VERIFY);
|
||||
if (dev)
|
||||
blkid_verify(cache, dev);
|
||||
blkid_put_cache(cache);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user