diff options
author | mav <mav@FreeBSD.org> | 2013-12-10 12:36:44 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2013-12-10 12:36:44 +0000 |
commit | 057ae4aad3a8bda9ecaf67047ba7cd49dcb0ac16 (patch) | |
tree | 829301412b806c49065688717dd1d2bd7088d492 /cddl/contrib/opensolaris/lib | |
parent | 28ab9c57056ffc8be0574b6cc4f6477afca314e0 (diff) | |
download | FreeBSD-src-057ae4aad3a8bda9ecaf67047ba7cd49dcb0ac16.zip FreeBSD-src-057ae4aad3a8bda9ecaf67047ba7cd49dcb0ac16.tar.gz |
Don't even try to read vdev labels from devices smaller then SPA_MINDEVSIZE
(64MB). Even if we would find one somehow, ZFS kernel code rejects such
devices. It is funny to look on attempts to read 4 256K vdev labels from
1.44MB floppy, though it is not very practical and quite slow.
Diffstat (limited to 'cddl/contrib/opensolaris/lib')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c index fa3d609..f683adb 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c @@ -995,10 +995,10 @@ nozpool_all_slices(avl_tree_t *r, const char *sname) #endif /* sun */ } +#ifdef sun static void check_slices(avl_tree_t *r, int fd, const char *sname) { -#ifdef sun struct extvtoc vtoc; struct dk_gpt *gpt; char diskname[MAXNAMELEN]; @@ -1028,8 +1028,8 @@ check_slices(avl_tree_t *r, int fd, const char *sname) check_one_slice(r, diskname, i, 0, 1); efi_free(gpt); } -#endif /* sun */ } +#endif /* sun */ static void zpool_open_func(void *arg) @@ -1059,6 +1059,7 @@ zpool_open_func(void *arg) return; } /* this file is too small to hold a zpool */ +#ifdef sun if (S_ISREG(statbuf.st_mode) && statbuf.st_size < SPA_MINDEVSIZE) { (void) close(fd); @@ -1070,6 +1071,12 @@ zpool_open_func(void *arg) */ check_slices(rn->rn_avl, fd, rn->rn_name); } +#else /* !sun */ + if (statbuf.st_size < SPA_MINDEVSIZE) { + (void) close(fd); + return; + } +#endif /* sun */ if ((zpool_read_label(fd, &config)) != 0) { (void) close(fd); |