From: Andrew Morton <akpm@linux-foundation.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, <stable@vger.kernel.org>,
<nbd-general@lists.sf.net>,
Paul Clements <Paul.Clements@steeleye.com>
Subject: Re: [PATCH 2/3] nbd: fsync and kill block device on shutdown
Date: Tue, 12 Feb 2013 13:41:55 -0800 [thread overview]
Message-ID: <20130212134155.f23f2223.akpm@linux-foundation.org> (raw)
In-Reply-To: <1360685171-3792-3-git-send-email-pbonzini@redhat.com>
On Tue, 12 Feb 2013 17:06:10 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:
> There are two problems with shutdown in the NBD driver. The first is
> that receiving the NBD_DISCONNECT ioctl does not sync the filesystem;
> this is useful because BLKFLSBUF is restricted to processes that have
> CAP_SYS_ADMIN, and the NBD client may not possess it (fsync of the
> block device does not sync the filesystem, either).
hm, this says that the lack of a sync is "useful". I think you mean
that the patch-which-adds-the-sync is the thing which is useful, yes?
> The second is that once we clear the socket we have no guarantee that
> later reads will come from the same backing storage. Thus the page cache
> must be cleaned, lest reads that hit on the page cache will return stale
> data from the previously-accessible disk.
That sounds like a problem.
> Example:
>
> # qemu-nbd -r -c/dev/nbd0 /dev/sr0
> # file -s /dev/nbd0
> /dev/stdin: # UDF filesystem data (version 1.5) etc.
> # qemu-nbd -d /dev/nbd0
> # qemu-nbd -r -c/dev/nbd0 /dev/sda
> # file -s /dev/nbd0
> /dev/stdin: # UDF filesystem data (version 1.5) etc.
>
> While /dev/sda has:
>
> # file -s /dev/sda
> /dev/sda: x86 boot sector; etc.
OK, we've described the problems but there's no description here of how
the patch addresses those problems.
How does this look?
: There are two problems with shutdown in the NBD driver.
:
: 1: Receiving the NBD_DISCONNECT ioctl does not sync the filesystem.
:
: This patch adds the sync operation into __nbd_ioctl()'s
: NBD_DISCONNECT handler. This is useful because BLKFLSBUF is restricted
: to processes that have CAP_SYS_ADMIN, and the NBD client may not
: possess it (fsync of the block device does not sync the filesystem,
: either).
:
: 2: Once we clear the socket we have no guarantee that later reads will
: come from the same backing storage.
:
: The patch adds calls to kill_bdev() in __nbd_ioctl()'s socket
: clearing code so the page cache is cleaned, lest reads that hit on the
: page cache will return stale data from the previously-accessible disk.
:
: Example:
:
: # qemu-nbd -r -c/dev/nbd0 /dev/sr0
: # file -s /dev/nbd0
: /dev/stdin: # UDF filesystem data (version 1.5) etc.
: # qemu-nbd -d /dev/nbd0
: # qemu-nbd -r -c/dev/nbd0 /dev/sda
: # file -s /dev/nbd0
: /dev/stdin: # UDF filesystem data (version 1.5) etc.
:
: While /dev/sda has:
:
: # file -s /dev/sda
: /dev/sda: x86 boot sector; etc.
next prev parent reply other threads:[~2013-02-12 21:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 16:06 [PATCH 0/3] NBD fixes for caching and block device flags Paolo Bonzini
2013-02-12 16:06 ` [PATCH 1/3] nbd: support FLUSH requests Paolo Bonzini
2013-02-12 17:37 ` Alex Bligh
2013-02-12 18:06 ` Paolo Bonzini
2013-02-12 21:32 ` Andrew Morton
2013-02-13 0:03 ` Alex Bligh
2013-02-13 13:00 ` Paolo Bonzini
2013-02-13 15:55 ` Alex Bligh
2013-02-13 16:02 ` Paolo Bonzini
2013-02-13 17:35 ` Alex Bligh
2013-02-13 0:00 ` Alex Bligh
2013-02-12 22:07 ` Paul Clements
2013-02-12 16:06 ` [PATCH 2/3] nbd: fsync and kill block device on shutdown Paolo Bonzini
2013-02-12 21:41 ` Andrew Morton [this message]
2013-02-13 13:05 ` Paolo Bonzini
2013-02-12 22:15 ` Paul Clements
2013-02-12 16:06 ` [PATCH 3/3] nbd: show read-only state in sysfs Paolo Bonzini
2013-02-12 22:16 ` Paul Clements
2013-02-12 21:43 ` [PATCH 0/3] NBD fixes for caching and block device flags Andrew Morton
2013-02-13 17:14 ` [Nbd] " Wouter Verhelst
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=20130212134155.f23f2223.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Paul.Clements@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd-general@lists.sf.net \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox