summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGiuseppe Di Natale <[email protected]>2017-04-12 15:49:31 -0700
committerBrian Behlendorf <[email protected]>2017-04-13 09:13:51 -0700
commita167aa7cd45b045047a75c07e06f3697bed8440c (patch)
treed8d82d60b253ad0445dc6c1292368ef4b5a28d5c /cmd
parent00481e7dad1d5608ae244eb053517e2c36d9a6de (diff)
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 <[email protected]> Signed-off-by: Giuseppe Di Natale <[email protected]> Closes #6009
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zpool/zpool_main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index ebadccf19..cc6c18eed 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -865,6 +865,10 @@ zpool_do_labelclear(int argc, char **argv)
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) {
(void) fprintf(stderr,
gettext("failed to check state for %s\n"), vdev);