mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Invalidate cache during a zpool labelclear
Be sure to invalidate a vdev's cache before performing a zpool labelclear. There are cases where the cache is stale because we did some operation that bypassed it, and since we are doing an open with only O_RDWR, we should invalidate it to be safe. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #6009
This commit is contained in:
parent
00481e7dad
commit
a167aa7cd4
@ -865,6 +865,10 @@ zpool_do_labelclear(int argc, char **argv)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ioctl(fd, BLKFLSBUF) != 0)
|
||||||
|
(void) fprintf(stderr, gettext("failed to invalidate "
|
||||||
|
"cache for %s: %s\n"), vdev, strerror(errno));
|
||||||
|
|
||||||
if (zpool_read_label(fd, &config, NULL) != 0 || config == NULL) {
|
if (zpool_read_label(fd, &config, NULL) != 0 || config == NULL) {
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("failed to check state for %s\n"), vdev);
|
gettext("failed to check state for %s\n"), vdev);
|
||||||
|
Loading…
Reference in New Issue
Block a user