All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: dm-devel@redhat.com
Subject: Re: blockdev --flushbufs required [was: parted issue/question
Date: Wed, 18 Jan 2012 15:05:14 +0100	[thread overview]
Message-ID: <4F16D19A.9030405@redhat.com> (raw)
In-Reply-To: <87haztruph.fsf_-_@rho.meyering.net>

Dne 18.1.2012 14:44, Jim Meyering napsal(a):
> [Following up on this thread:
>   http://thread.gmane.org/gmane.linux.kernel.device-mapper.devel/14999]
>
> Alasdair G Kergon wrote:
>> Try
>>    blkdev --flushbufs
>> after any cmd that writes to a dev to see if that makes any difference.
>
> Thanks for the work-around.
> Using "blockdev --flushbufs $dev" does indeed make parted
> behave the same with dm-backed storage as with other devices.
>
> Adjusting my small example,
>
>    cd /tmp; truncate -s 10m g&&  loop=$(losetup --show -f g)
>    echo 0 100 linear $loop 0 | dmsetup create zub
>    dev=/dev/mapper/zub
>    parted -s $dev \
>      mklabel gpt \
>      mkpart efi 34s 34s \
>      mkpart root 35s 35s \
>      mkpart roo2 36s 36s \
>      u s p
>    blockdev --flushbufs $dev # FIXME: required with device-mapper-1.02.65-5
>
>    # write random bits to p1
>    dd of=${dev}p1 if=/dev/urandom count=1
>    dd if=${dev}p1 of=p1-copy.pre count=1
>    parted -s $dev mkpart p4 37s 37s
>    blockdev --flushbufs $dev # FIXME: required with device-mapper-1.02.65-5
>
>    dd if=${dev}p1 of=p1-copy.post count=1
>    cmp -l p1-copy.pre p1-copy.post
>
> With that, the "cmp" show no differences.
>
> Does this sound like a problem in device-mapper land,
> or in how parted interacts with DM?


Just my wild guess it could be related to wrong assumption that close of 
descriptor means automatic flush - this is only true in the case, there is 
only one user for descriptor so it would be the last user - but if e.g. the 
device is opened more then once, then close doesn't mean flush - so I'd have 
assume some application is missing fsync(fd) before doing close(fd).

Zdenek

  parent reply	other threads:[~2012-01-18 14:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F13ADB3.5070806@redhat.com>
2012-01-17 22:28 ` parted issue/question Jim Meyering
2012-01-18  0:38   ` Alasdair G Kergon
2012-01-18 13:44     ` blockdev --flushbufs required [was: " Jim Meyering
     [not found]       ` <87haztruph.fsf_-_-CybKA8TIZ99x3y/oJEDuiw@public.gmane.org>
2012-01-18 13:58         ` [ovirt-devel] " Mike Burns
     [not found]           ` <1326895081.27879.0.camel-GBFV1wXchybjvs0ExVSBjSAqptkPoUJl@public.gmane.org>
2012-01-18 16:22             ` Alan Pevec
     [not found]               ` <CAGi==UV2RXGzpxtKa4_4JWqdWrMP6_pf_PrdyDMtjMmSQtXgPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-19 13:00                 ` Jim Meyering
2012-01-18 14:05       ` Zdenek Kabelac [this message]
2012-01-18 14:14         ` Alasdair G Kergon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F16D19A.9030405@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.