Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151358968
D33403.id101600.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
757 B
Referenced Files
None
Subscribers
None
D33403.id101600.diff
View Options
diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c
--- a/usr.sbin/bhyve/block_if.c
+++ b/usr.sbin/bhyve/block_if.c
@@ -667,14 +667,24 @@
{
struct blockif_ctxt *bc;
struct stat sb;
+ off_t mediasize;
if (fstat(fd, &sb) != 0)
return;
+ if (S_ISCHR(sb.st_mode)) {
+ if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) < 0) {
+ EPRINTLN("blockif_resized: get mediasize failed: %s",
+ strerror(errno));
+ return;
+ }
+ } else
+ mediasize = sb.st_size;
+
bc = arg;
pthread_mutex_lock(&bc->bc_mtx);
- if (sb.st_size != bc->bc_size) {
- bc->bc_size = sb.st_size;
+ if (mediasize != bc->bc_size) {
+ bc->bc_size = mediasize;
bc->bc_resize_cb(bc, bc->bc_resize_cb_arg, bc->bc_size);
}
pthread_mutex_unlock(&bc->bc_mtx);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 9:12 PM (10 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31115456
Default Alt Text
D33403.id101600.diff (757 B)
Attached To
Mode
D33403: bhyve: get mediasize for character devices when resizing virtio-blk
Attached
Detach File
Event Timeline
Log In to Comment