Bug in BLKBSZSET/GET ioctl ?
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
Then, I looked into upstream util-linux and it seems nothing wrong. I'm not convinced that it's a kernel bug.
produce:
---
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 2048 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096
---
I'm not sure if it is related to write-back, but still CCed to Fengguang.
Thanks,
-Wanlong Gao
Quoted 3 lines · Wanlong Gao
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
The blockdev-get/setbsz in *libguestfs* is just a wraper of util-linux's *blockdev --get/setbsz*.
Quoted 23 lines
Then, I looked into upstream util-linux and it seems nothing wrong. I'm not convinced that it's a kernel bug.
produce:
---
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 2048 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096---
I'm not sure if it is related to write-back, but still CCed to Fengguang.
Thanks,
-Wanlong Gao
Quoted 9 lines · Wanlong Gao
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
Then, I looked into upstream util-linux and it seems nothing wrong. I'm not convinced that it's a kernel bug.
produce:
---
Quoted 8 lines
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 2048 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096
I think each blockdev invocation is working on a *new* bdev object. You'll get consistent results if somehow keep it referenced, for example, run a background copy task:
# cp /dev/sda6 /dev/null &
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6
Thanks,
Fengguang
Quoted 19 lines · Wu Fengguang
Quoted 9 lines · Wanlong Gao
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
Then, I looked into upstream util-linux and it seems nothing wrong. I'm not convinced that it's a kernel bug.
produce:
---
Quoted 8 lines
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 2048 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096
Quoted 1 line
I think each blockdev invocation is working on a *new* bdev object.
But the address of *new* bdev is the same?
I did printk, and they all returned the same address.
Quoted 1 line
You'll get consistent results if somehow keep it referenced, for
But isn't it a bug? It seems that the setbsz has no effect?
Thanks,
-Wanlong
Quoted 11 lines
example, run a background copy task:
# cp /dev/sda6 /dev/null &# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6Thanks,
Fengguang
Quoted 21 lines · Wanlong Gao
Quoted 19 lines · Wu Fengguang
Quoted 17 lines · Wanlong Gao
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
Then, I looked into upstream util-linux and it seems nothing wrong. I'm not convinced that it's a kernel bug.
produce:
---
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 2048 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096
Quoted 5 lines
Quoted 1 line
I think each blockdev invocation is working on a *new* bdev object.
But the address of *new* bdev is the same?
I did printk, and they all returned the same address.
Then the block size value should be reset in one of the bd_set_size() calls in __blkdev_get().
Quoted 4 lines
Quoted 1 line
You'll get consistent results if somehow keep it referenced, for
But isn't it a bug? It seems that the setbsz has no effect?
Yeah, it does look like unexpected behavior to the end user..
Thanks,
Fengguang
Quoted 22 lines · Wu Fengguang
Quoted 21 lines · Wanlong Gao
Quoted 19 lines · Wu Fengguang
Quoted 17 lines · Wanlong Gao
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
Then, I looked into upstream util-linux and it seems nothing wrong. I'm not convinced that it's a kernel bug.
produce:
---
# ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 2048 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096 # ./util-linux/disk-utils/blockdev --setbsz 512 /dev/sda6 # ./util-linux/disk-utils/blockdev --getbsz /dev/sda6 4096
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I think each blockdev invocation is working on a *new* bdev object.
But the address of *new* bdev is the same?
I did printk, and they all returned the same address.Then the block size value should be reset in one of the
bd_set_size()calls in__blkdev_get().
Is the behaviour right that setting bd_block_size to the logical_block_size every time when __blkdev_get()?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
You'll get consistent results if somehow keep it referenced, for
But isn't it a bug? It seems that the setbsz has no effect?
Yeah, it does look like unexpected behavior to the end user..
And at least, the ioctl BLKBZSET seems useless.
Thanks
-Wanlong
Quoted 4 lines
Thanks,
Fengguang
Quoted 8 lines · Wanlong Gao
Quoted 3 lines · Wanlong Gao
Hi all:
This is first reported to *libguestfs*: https://bugzilla.redhat.com/show_bug.cgi?id=624335
The blockdev-get/setbsz in *libguestfs* is just a wraper of util-linux's *blockdev --get/setbsz*.
Agreed.
I don't think libguestfs is anything to do with it, since those commands simply translate to running/sbin/blockdev --{get,set}bsz /dev/sdX:
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top