Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch
This commit is contained in:
commit
22c51d6136
|
@ -125,7 +125,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare)
|
||||||
pool_state_t state;
|
pool_state_t state;
|
||||||
boolean_t inuse;
|
boolean_t inuse;
|
||||||
|
|
||||||
if ((fd = open(file, O_RDONLY)) < 0)
|
if ((fd = open(file, O_RDONLY|O_EXCL)) < 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) == 0 && inuse) {
|
if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) == 0 && inuse) {
|
||||||
|
@ -250,7 +250,7 @@ check_disk(const char *path, blkid_cache cache, int force,
|
||||||
* not easily decode the MBR return a failure and prompt to the
|
* not easily decode the MBR return a failure and prompt to the
|
||||||
* user to use force option since we cannot check the partitions.
|
* user to use force option since we cannot check the partitions.
|
||||||
*/
|
*/
|
||||||
if ((fd = open(path, O_RDWR|O_DIRECT)) < 0) {
|
if ((fd = open(path, O_RDWR|O_DIRECT|O_EXCL)) < 0) {
|
||||||
check_error(errno);
|
check_error(errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ is_whole_disk(const char *arg)
|
||||||
|
|
||||||
(void) snprintf(path, sizeof (path), "%s%s%s",
|
(void) snprintf(path, sizeof (path), "%s%s%s",
|
||||||
RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE);
|
RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE);
|
||||||
if ((fd = open(path, O_RDWR|O_DIRECT)) < 0)
|
if ((fd = open(path, O_RDWR|O_DIRECT|O_EXCL)) < 0)
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
if (efi_alloc_and_init(fd, EFI_NUMPAR, &label) != 0) {
|
if (efi_alloc_and_init(fd, EFI_NUMPAR, &label) != 0) {
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
|
@ -498,7 +498,7 @@ make_leaf_vdev(const char *arg, uint64_t is_log)
|
||||||
ddi_devid_t devid;
|
ddi_devid_t devid;
|
||||||
char *minor = NULL, *devid_str = NULL;
|
char *minor = NULL, *devid_str = NULL;
|
||||||
|
|
||||||
if ((fd = open(path, O_RDONLY)) < 0) {
|
if ((fd = open(path, O_RDONLY|O_EXCL)) < 0) {
|
||||||
(void) fprintf(stderr, gettext("cannot open '%s': "
|
(void) fprintf(stderr, gettext("cannot open '%s': "
|
||||||
"%s\n"), path, strerror(errno));
|
"%s\n"), path, strerror(errno));
|
||||||
nvlist_free(vdev);
|
nvlist_free(vdev);
|
||||||
|
@ -891,7 +891,7 @@ zero_label(char *path)
|
||||||
char buf[size];
|
char buf[size];
|
||||||
int err, fd;
|
int err, fd;
|
||||||
|
|
||||||
if ((fd = open(path, O_WRONLY)) < 0) {
|
if ((fd = open(path, O_WRONLY|O_EXCL)) < 0) {
|
||||||
(void) fprintf(stderr, gettext("cannot open '%s': %s\n"),
|
(void) fprintf(stderr, gettext("cannot open '%s': %s\n"),
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -1045,7 +1045,7 @@ is_spare(nvlist_t *config, const char *path)
|
||||||
uint_t i, nspares;
|
uint_t i, nspares;
|
||||||
boolean_t inuse;
|
boolean_t inuse;
|
||||||
|
|
||||||
if ((fd = open(path, O_RDONLY)) < 0)
|
if ((fd = open(path, O_RDONLY|O_EXCL)) < 0)
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
|
||||||
if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0 ||
|
if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0 ||
|
||||||
|
|
|
@ -191,7 +191,7 @@ efi_get_info(int fd, struct dk_cinfo *dki_info)
|
||||||
&dki_info->dki_partition);
|
&dki_info->dki_partition);
|
||||||
} else if ((strncmp(dev_path, "/dev/dm-", 8) == 0)) {
|
} else if ((strncmp(dev_path, "/dev/dm-", 8) == 0)) {
|
||||||
strcpy(dki_info->dki_cname, "pseudo");
|
strcpy(dki_info->dki_cname, "pseudo");
|
||||||
dki_info->dki_ctype = DKC_MD;
|
dki_info->dki_ctype = DKC_VBD;
|
||||||
rval = sscanf(dev_path, "/dev/%[a-zA-Z0-9-]p%hu",
|
rval = sscanf(dev_path, "/dev/%[a-zA-Z0-9-]p%hu",
|
||||||
dki_info->dki_dname,
|
dki_info->dki_dname,
|
||||||
&dki_info->dki_partition);
|
&dki_info->dki_partition);
|
||||||
|
@ -281,8 +281,7 @@ efi_alloc_and_init(int fd, uint32_t nparts, struct dk_gpt **vtoc)
|
||||||
|
|
||||||
if ((dki_info.dki_ctype == DKC_PCMCIA_MEM) ||
|
if ((dki_info.dki_ctype == DKC_PCMCIA_MEM) ||
|
||||||
(dki_info.dki_ctype == DKC_VBD) ||
|
(dki_info.dki_ctype == DKC_VBD) ||
|
||||||
(dki_info.dki_ctype == DKC_UNKNOWN) ||
|
(dki_info.dki_ctype == DKC_UNKNOWN))
|
||||||
(dki_info.dki_ctype == DKC_MD))
|
|
||||||
return (-1);
|
return (-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue