From: "Steven J. Magnani" <steve@digidescorp.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Stevie Trujillo <stevie.trujillo@gmail.com>,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: Re: mount -o loop with truncated dosdisk.img uses 100% cpu and can't be killed
Date: Thu, 12 Jul 2012 14:39:46 -0500 [thread overview]
Message-ID: <1342121986.2156.20.camel@iscandar.digidescorp.com> (raw)
In-Reply-To: <87k3y8yed3.fsf@devron.myhome.or.jp>
On Fri, 2012-07-13 at 04:21 +0900, OGAWA Hirofumi wrote:
> > On Thu, 2012-07-12 at 16:28 +0200, Stevie Trujillo wrote:
> >> Hello,
> >>
> >> I was trying to create a bootdisk to update my BIOS, and accidentially
> >> made a 512byte image with only the FreeDOS header in it.
> >>
> >> ( Linux 3.4.4 )
> >> # mount -o loop dosdisk.img /tmp
> >> ^C^C^C
> >> It uses 100% CPU and doesn't listen to me when I do ^C, kill -9 etc. I
> >> think this means it's stuck in the kernel?
> It looks like the bug of __getblk_slow(). If requested block was beyond
> end of device, __find_get_block() will find buffer_mapped()'s buffer,
> but block >= end_block is unmapped. So, it can be loop.
>
> The following patch fixes it? If it fix, there are some options to check
> it.
>
> a) Check it like this patch and warn.
> b) (a), but without warn.
> c) Check it in init_page_buffers() and return -EIO or such
>
> Well, anyway, Cc to Jens.
>
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> ---
>
> fs/buffer.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff -puN fs/buffer.c~debug fs/buffer.c
> --- tux3fs/fs/buffer.c~debug 2012-07-13 04:10:40.000000000 +0900
> +++ tux3fs-hirofumi/fs/buffer.c 2012-07-13 04:11:50.000000000 +0900
> @@ -1055,6 +1055,13 @@ __getblk_slow(struct block_device *bdev,
> dump_stack();
> return NULL;
> }
> + if (block >= blkdev_max_block(I_BDEV(bdev->bd_inode))) {
> + printk(KERN_ERR "getblk(): block %llu, end_block %llu\n",
> + (unsigned long long)block,
> + (unsigned long long)blkdev_max_block(I_BDEV(bdev->bd_inode)));
> + dump_stack();
> + return NULL;
> + }
>
> for (;;) {
> struct buffer_head * bh;
> _
This fixes the hang, but I'm not sure dump_stack() is a good idea. I get
almost 100 lines of stack dumps and error messages in my kernel log.
Also, I was a little surprised to see that mount completes successfully.
------------------------------------------------------------------------
Steven J. Magnani "I claim this network for MARS!
www.digidescorp.com Earthling, return my space modulator!"
#include <standard.disclaimer>
next prev parent reply other threads:[~2012-07-12 19:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 14:28 mount -o loop with truncated dosdisk.img uses 100% cpu and can't be killed Stevie Trujillo
2012-07-12 15:16 ` Steven J. Magnani
2012-07-12 19:21 ` OGAWA Hirofumi
2012-07-12 19:39 ` Steven J. Magnani [this message]
2012-07-12 19:49 ` OGAWA Hirofumi
2012-07-13 15:43 ` Jan Kara
2012-07-13 15:52 ` Jeff Moyer
2012-07-13 20:51 ` Jeff Moyer
-- strict thread matches above, loose matches on Subject: below --
2012-07-13 9:18 Wolfram Gloger
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=1342121986.2156.20.camel@iscandar.digidescorp.com \
--to=steve@digidescorp.com \
--cc=axboe@kernel.dk \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=stevie.trujillo@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox