From: MITSUNARI Shigeo <herumi@nifty.com>
To: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
MITSUNARI Shigeo <herumi@nifty.com>
Subject: [PATCH 0/2] bd_invalidated shoud be cleared in revalidate_disk
Date: Fri, 19 Oct 2012 12:16:40 +0900 [thread overview]
Message-ID: <1350616602-6892-1-git-send-email-herumi@nifty.com> (raw)
rescan_partitions() and invalidate_partitions() in block/partition-generic.c
set bdev->bd_invalidated = 0 after calling check_disk_size_change().
But revalidate_disk() in fs/block_dev.c does not clear it.
If bdev->bd_invalidated = 1 then rescan_partitions() is called when
__blkdev_get() is called.
So if revalidate_disk() is once called, all buffer cache pages will be
cleared whenever the device is opened.
This bug causes the following problem.
mdadm monitor will clear file cache every 1000 seconds
after mdadm resize is executed once.
mdadm monitor only openes the device with O_RDONLY.
We verified the problem occurred at kernel 3.6.2 and mdadm v3.2.5 on
ubuntu 12.04LTS x86_64 and the patch worked well.
---
The following steps will reproduce the problem.
1. prepair a block device(ex. /dev/sdb).
2. create two partitions.
sudo parted /dev/sdb
mklabel gpt
mkpart primary 0% 50%
mkpart primary 50% 100%
3. create a md device.
sudo mdadm -C /dev/md/hoge -l 1 -n 2 -e 1.2 --assume-clean --auto=md \
--symlink=no /dev/sdb1 /dev/sdb2
4. create file system and mount it
sudo mkfs.ext3 /dev/md/hoge
sudo mkdir /mnt/test
sudo mount /dev/md/hoge /mnt/test
5. try to resize the device
sudo mdadm -G /dev/md/hoge --size=max
6. create a file to fill file cache.
sudo dd if=/dev/urandom of=/mnt/test/data bs=1M count=10
and verity the current status of file by free command.
7. mdadm monitor will open the md device every 1000 seconds
and you will find all file cache on the device are cleared.
The timing can be reduced by the following steps.
a) kill mdadm and restart it with --delay option
/sbin/mdadm --monitor --delay=30 --pid-file /var/run/mdadm/monitor.pid \
--daemonise --scan --syslog
or open the md device directly.
sudo dd if=/dev/md/hoge of=/dev/null bs=4096 count=1
MITSUNARI Shigeo (2):
block: fs: bd_invalidated should be cleared in revalidate_disk
block: fs: move 'bdev->bd_invalidated = 0' into
check_disk_size_change() instead of putting the code every time
after check_disk_size_change().
block/partition-generic.c | 2 --
fs/block_dev.c | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)
--
1.7.9.5
next reply other threads:[~2012-10-19 3:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 3:16 MITSUNARI Shigeo [this message]
2012-10-19 3:16 ` [PATCH 1/2] block: fs: bd_invalidated should " MITSUNARI Shigeo
2012-10-19 3:16 ` [PATCH 2/2] block: fs: move 'bdev->bd_invalidated = 0' into check_disk_size_change() instead of putting the code every time after check_disk_size_change() MITSUNARI Shigeo
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=1350616602-6892-1-git-send-email-herumi@nifty.com \
--to=herumi@nifty.com \
--cc=axboe@kernel.dk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®