* Bug in BLKBSZSET/GET ioctl ?
@ 2011-12-29 3:51 Wanlong Gao
2011-12-29 3:56 ` Wanlong Gao
2011-12-29 4:20 ` Wu Fengguang
0 siblings, 2 replies; 7+ messages in thread
From: Wanlong Gao @ 2011-12-29 3:51 UTC (permalink / raw)
To: linux-fsdevel, linux-kernel; +Cc: fengguang.wu
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in BLKBSZSET/GET ioctl ?
2011-12-29 3:51 Bug in BLKBSZSET/GET ioctl ? Wanlong Gao
@ 2011-12-29 3:56 ` Wanlong Gao
2011-12-29 8:19 ` Richard W.M. Jones
2011-12-29 4:20 ` Wu Fengguang
1 sibling, 1 reply; 7+ messages in thread
From: Wanlong Gao @ 2011-12-29 3:56 UTC (permalink / raw)
Cc: gaowanlong, linux-fsdevel, linux-kernel, fengguang.wu
On 12/29/2011 11:51 AM, Wanlong Gao wrote:
> 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*.
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in BLKBSZSET/GET ioctl ?
2011-12-29 3:56 ` Wanlong Gao
@ 2011-12-29 8:19 ` Richard W.M. Jones
0 siblings, 0 replies; 7+ messages in thread
From: Richard W.M. Jones @ 2011-12-29 8:19 UTC (permalink / raw)
To: Wanlong Gao; +Cc: linux-fsdevel, linux-kernel, fengguang.wu
On Thu, Dec 29, 2011 at 11:56:27AM +0800, Wanlong Gao wrote:
> On 12/29/2011 11:51 AM, Wanlong Gao wrote:
>
> > 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:
http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/blockdev.c;h=d056abef1739de7b9e9aab118c138bae403e11e5;hb=HEAD#l106
Rich.
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in BLKBSZSET/GET ioctl ?
2011-12-29 3:51 Bug in BLKBSZSET/GET ioctl ? Wanlong Gao
2011-12-29 3:56 ` Wanlong Gao
@ 2011-12-29 4:20 ` Wu Fengguang
2011-12-29 4:28 ` Wanlong Gao
1 sibling, 1 reply; 7+ messages in thread
From: Wu Fengguang @ 2011-12-29 4:20 UTC (permalink / raw)
To: Wanlong Gao; +Cc: linux-fsdevel, linux-kernel
On Thu, Dec 29, 2011 at 11:51:45AM +0800, Wanlong Gao wrote:
> 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 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in BLKBSZSET/GET ioctl ?
2011-12-29 4:20 ` Wu Fengguang
@ 2011-12-29 4:28 ` Wanlong Gao
2011-12-29 4:40 ` Wu Fengguang
0 siblings, 1 reply; 7+ messages in thread
From: Wanlong Gao @ 2011-12-29 4:28 UTC (permalink / raw)
To: Wu Fengguang; +Cc: linux-fsdevel, linux-kernel
On 12/29/2011 12:20 PM, Wu Fengguang wrote:
> On Thu, Dec 29, 2011 at 11:51:45AM +0800, Wanlong Gao wrote:
>> 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 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.
> 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
> 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in BLKBSZSET/GET ioctl ?
2011-12-29 4:28 ` Wanlong Gao
@ 2011-12-29 4:40 ` Wu Fengguang
2011-12-29 6:09 ` Wanlong Gao
0 siblings, 1 reply; 7+ messages in thread
From: Wu Fengguang @ 2011-12-29 4:40 UTC (permalink / raw)
To: Wanlong Gao; +Cc: linux-fsdevel, linux-kernel
On Thu, Dec 29, 2011 at 12:28:44PM +0800, Wanlong Gao wrote:
> On 12/29/2011 12:20 PM, Wu Fengguang wrote:
>
> > On Thu, Dec 29, 2011 at 11:51:45AM +0800, Wanlong Gao wrote:
> >> 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 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().
> > 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bug in BLKBSZSET/GET ioctl ?
2011-12-29 4:40 ` Wu Fengguang
@ 2011-12-29 6:09 ` Wanlong Gao
0 siblings, 0 replies; 7+ messages in thread
From: Wanlong Gao @ 2011-12-29 6:09 UTC (permalink / raw)
To: Wu Fengguang; +Cc: linux-fsdevel, linux-kernel
On 12/29/2011 12:40 PM, Wu Fengguang wrote:
> On Thu, Dec 29, 2011 at 12:28:44PM +0800, Wanlong Gao wrote:
>> On 12/29/2011 12:20 PM, Wu Fengguang wrote:
>>
>>> On Thu, Dec 29, 2011 at 11:51:45AM +0800, Wanlong Gao wrote:
>>>> 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 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()?
>
>>> 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
>
> Thanks,
> Fengguang
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-29 8:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 3:51 Bug in BLKBSZSET/GET ioctl ? Wanlong Gao
2011-12-29 3:56 ` Wanlong Gao
2011-12-29 8:19 ` Richard W.M. Jones
2011-12-29 4:20 ` Wu Fengguang
2011-12-29 4:28 ` Wanlong Gao
2011-12-29 4:40 ` Wu Fengguang
2011-12-29 6:09 ` Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).