public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Laurent GUERBY <laurent@guerby.net>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [2.6.29-rc5][BUG] swapon on vfat file gets stuck on inode lock
Date: Thu, 12 Mar 2009 03:13:34 +0900	[thread overview]
Message-ID: <874oy0orld.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <87ocw80z6s.fsf@devron.myhome.or.jp> (OGAWA Hirofumi's message of "Thu, 12 Mar 2009 02:03:23 +0900")

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> I'm sure that path touch the metadata without locking (so, reused entry
> can not be for that inode anymore). However, I guess the result doesn't
> become any fs corruption, so and other fs is ignoring the possibly wrong
> result of bmap().
>
> I'm thinking to use this patch instead of removing.

Ok. Simple stress test was done. BTW, since fat caches the metadata on
that path, fat would be sensitive to race more than other fs.

Anyway, if you are ok, please apply. Otherwise, I'm going to prepare for
this patch to next merge window.

Thanks.

> [PATCH] Fix _fat_bmap() locking
>
> On swapon() path, it has already i_mutex. So, this uses i_alloc_sem
> instead of it.
>
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> ---
>
>  fs/fat/inode.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff -puN fs/fat/inode.c~fat_bmap-locking-fix fs/fat/inode.c
> --- linux-2.6/fs/fat/inode.c~fat_bmap-locking-fix	2009-03-12 00:47:15.000000000 +0900
> +++ linux-2.6-hirofumi/fs/fat/inode.c	2009-03-12 00:47:42.000000000 +0900
> @@ -202,9 +202,9 @@ static sector_t _fat_bmap(struct address
>  	sector_t blocknr;
>  
>  	/* fat_get_cluster() assumes the requested blocknr isn't truncated. */
> -	mutex_lock(&mapping->host->i_mutex);
> +	down_read(&mapping->host->i_alloc_sem);
>  	blocknr = generic_block_bmap(mapping, block, fat_get_block);
> -	mutex_unlock(&mapping->host->i_mutex);
> +	up_read(&mapping->host->i_alloc_sem);
>  
>  	return blocknr;
>  }
> _

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2009-03-11 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 13:57 [2.6.29-rc5][BUG] swapon on vfat file gets stuck on inode lock Laurent GUERBY
2009-03-11 15:53 ` Linus Torvalds
2009-03-11 16:45   ` Laurent GUERBY
2009-03-11 17:03   ` OGAWA Hirofumi
2009-03-11 18:13     ` OGAWA Hirofumi [this message]
2009-03-11 18:19       ` Linus Torvalds
2009-03-16  8:34   ` Christoph Hellwig

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=874oy0orld.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=laurent@guerby.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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