Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148075592
D33403.id99906.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
788 B
Referenced Files
None
Subscribers
None
D33403.id99906.diff
View Options
Index: usr.sbin/bhyve/block_if.c
===================================================================
--- usr.sbin/bhyve/block_if.c
+++ 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\n",
+ 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
Mon, Mar 16, 2:25 PM (2 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29773977
Default Alt Text
D33403.id99906.diff (788 B)
Attached To
Mode
D33403: bhyve: get mediasize for character devices when resizing virtio-blk
Attached
Detach File
Event Timeline
Log In to Comment