reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, reiserfs-devel@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: Re: [Bug] possible circular locking in reiserfs_unpack
Date: Wed, 22 Sep 2010 19:22:31 +0200	[thread overview]
Message-ID: <20100922172231.GA1924@del.dom.local> (raw)
In-Reply-To: <20100922134944.GA6549@nowhere>

On Wed, Sep 22, 2010 at 03:49:48PM +0200, Frederic Weisbecker wrote:
> 
> I can reproduce your first case, but not this one.
> 
> So, I hope you can give a try to the following fix,
> 
> Thanks!
> 

With this patch I don't have any lockdep warnings during lilo writes.

Well done, thanks!

Tested-by: Jarek Poplawski <jarkao2@gmail.com>

> 
> diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
> index f53505d..90a757b 100644
> --- a/fs/reiserfs/ioctl.c
> +++ b/fs/reiserfs/ioctl.c
> @@ -170,7 +170,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
>  int reiserfs_unpack(struct inode *inode, struct file *filp)
>  {
>  	int retval = 0;
> -	int index;
> +	int index, depth;
>  	struct page *page;
>  	struct address_space *mapping;
>  	unsigned long write_from;
> @@ -185,11 +185,12 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
>  		return 0;
>  	}
>  
> +	depth = reiserfs_write_lock_once(inode->i_sb);
> +
>  	/* we need to make sure nobody is changing the file size beneath
>  	 ** us
>  	 */
> -	mutex_lock(&inode->i_mutex);
> -	reiserfs_write_lock(inode->i_sb);
> +	reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb);
>  
>  	write_from = inode->i_size & (blocksize - 1);
>  	/* if we are on a block boundary, we are already unpacked.  */
> @@ -224,6 +225,6 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
>  
>        out:
>  	mutex_unlock(&inode->i_mutex);
> -	reiserfs_write_unlock(inode->i_sb);
> +	reiserfs_write_unlock_once(inode->i_sb, depth);
>  	return retval;
>  }
> 

      reply	other threads:[~2010-09-22 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-05 11:31 [Bug] possible circular locking in reiserfs_unpack Jarek Poplawski
2010-09-08 22:37 ` Andrew Morton
2010-09-09  1:53   ` Frederic Weisbecker
2010-09-09  6:07     ` Jarek Poplawski
2010-09-09 14:55     ` Jarek Poplawski
2010-09-09 15:34       ` Frederic Weisbecker
2010-09-22 13:49       ` Frederic Weisbecker
2010-09-22 17:22         ` Jarek Poplawski [this message]

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=20100922172231.GA1924@del.dom.local \
    --to=jarkao2@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-devel@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;
as well as URLs for NNTP newsgroup(s).