linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol
@ 2012-08-02 23:16 Alexander Block
  2012-08-03 21:13 ` Josef Bacik
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Block @ 2012-08-02 23:16 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Alexander Block

We got a recursive lock in mksubvol because the caller already held
a lock. I think we got into this due to a merge error. Commit a874a63
removed the mnt_want_write call from btrfs_mksubvol and added a
replacement call to mnt_want_write_file in btrfs_ioctl_snap_create_transid.
Commit e7848683 however tried to move all calls to mnt_want_write above
i_mutex. So somewhere while merging this, it got mixed up. The
solution is to remove the mnt_want_write call completely from
mksubvol.

Reported-by: David Sterba <dave@jikos.cz>
Signed-off-by: Alexander Block <ablock84@googlemail.com>
---
 fs/btrfs/ioctl.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 00ddf22..9df50fa 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -664,10 +664,6 @@ static noinline int btrfs_mksubvol(struct path *parent,
 	struct dentry *dentry;
 	int error;
 
-	error = mnt_want_write(parent->mnt);
-	if (error)
-		return error;
-
 	mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
 
 	dentry = lookup_one_len(name, parent->dentry, namelen);
@@ -703,7 +699,6 @@ out_dput:
 	dput(dentry);
 out_unlock:
 	mutex_unlock(&dir->i_mutex);
-	mnt_drop_write(parent->mnt);
 	return error;
 }
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol
  2012-08-02 23:16 [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol Alexander Block
@ 2012-08-03 21:13 ` Josef Bacik
  2012-08-03 23:39   ` Alexander Block
  0 siblings, 1 reply; 5+ messages in thread
From: Josef Bacik @ 2012-08-03 21:13 UTC (permalink / raw)
  To: Alexander Block; +Cc: linux-btrfs@vger.kernel.org

On Thu, Aug 02, 2012 at 05:16:20PM -0600, Alexander Block wrote:
> We got a recursive lock in mksubvol because the caller already held
> a lock. I think we got into this due to a merge error. Commit a874a63
> removed the mnt_want_write call from btrfs_mksubvol and added a
> replacement call to mnt_want_write_file in btrfs_ioctl_snap_create_transid.
> Commit e7848683 however tried to move all calls to mnt_want_write above
> i_mutex. So somewhere while merging this, it got mixed up. The
> solution is to remove the mnt_want_write call completely from
> mksubvol.
> 
> Reported-by: David Sterba <dave@jikos.cz>
> Signed-off-by: Alexander Block <ablock84@googlemail.com>
> ---
>  fs/btrfs/ioctl.c |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 00ddf22..9df50fa 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -664,10 +664,6 @@ static noinline int btrfs_mksubvol(struct path *parent,
>  	struct dentry *dentry;
>  	int error;
>  
> -	error = mnt_want_write(parent->mnt);
> -	if (error)
> -		return error;
> -
>  	mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
>  
>  	dentry = lookup_one_len(name, parent->dentry, namelen);
> @@ -703,7 +699,6 @@ out_dput:
>  	dput(dentry);
>  out_unlock:
>  	mutex_unlock(&dir->i_mutex);
> -	mnt_drop_write(parent->mnt);
>  	return error;
>  }
>  

I'm confused, this isn't here in btrfs-next, so is this a problem still?
Thanks,

Josef

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol
  2012-08-03 21:13 ` Josef Bacik
@ 2012-08-03 23:39   ` Alexander Block
  2012-08-08 15:20     ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Block @ 2012-08-03 23:39 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs@vger.kernel.org

On Fri, Aug 3, 2012 at 11:13 PM, Josef Bacik <jbacik@fusionio.com> wrote:
> On Thu, Aug 02, 2012 at 05:16:20PM -0600, Alexander Block wrote:
>> We got a recursive lock in mksubvol because the caller already held
>> a lock. I think we got into this due to a merge error. Commit a874a63
>> removed the mnt_want_write call from btrfs_mksubvol and added a
>> replacement call to mnt_want_write_file in btrfs_ioctl_snap_create_transid.
>> Commit e7848683 however tried to move all calls to mnt_want_write above
>> i_mutex. So somewhere while merging this, it got mixed up. The
>> solution is to remove the mnt_want_write call completely from
>> mksubvol.
>>
>> Reported-by: David Sterba <dave@jikos.cz>
>> Signed-off-by: Alexander Block <ablock84@googlemail.com>
>> ---
>>  fs/btrfs/ioctl.c |    5 -----
>>  1 file changed, 5 deletions(-)
>>
>> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
>> index 00ddf22..9df50fa 100644
>> --- a/fs/btrfs/ioctl.c
>> +++ b/fs/btrfs/ioctl.c
>> @@ -664,10 +664,6 @@ static noinline int btrfs_mksubvol(struct path *parent,
>>       struct dentry *dentry;
>>       int error;
>>
>> -     error = mnt_want_write(parent->mnt);
>> -     if (error)
>> -             return error;
>> -
>>       mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
>>
>>       dentry = lookup_one_len(name, parent->dentry, namelen);
>> @@ -703,7 +699,6 @@ out_dput:
>>       dput(dentry);
>>  out_unlock:
>>       mutex_unlock(&dir->i_mutex);
>> -     mnt_drop_write(parent->mnt);
>>       return error;
>>  }
>>
>
> I'm confused, this isn't here in btrfs-next, so is this a problem still?
It's in linus current master. Lio Bo moved the call out of
btrfs_mksubvol into the caller. Later a commit from Jan Kara tried to
move the call inside mksubvol below i_mutex. If I understand the logs
correctly, It was then merged incorrectly.
> Thanks,
>
> Josef

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol
  2012-08-03 23:39   ` Alexander Block
@ 2012-08-08 15:20     ` David Sterba
  2012-08-08 15:40       ` Chris Mason
  0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2012-08-08 15:20 UTC (permalink / raw)
  To: Alexander Block; +Cc: Josef Bacik, linux-btrfs@vger.kernel.org

On Sat, Aug 04, 2012 at 01:39:25AM +0200, Alexander Block wrote:
> On Fri, Aug 3, 2012 at 11:13 PM, Josef Bacik <jbacik@fusionio.com> wrote:
> > I'm confused, this isn't here in btrfs-next, so is this a problem still?
>
> It's in linus current master. Lio Bo moved the call out of
> btrfs_mksubvol into the caller. Later a commit from Jan Kara tried to
> move the call inside mksubvol below i_mutex. If I understand the logs
> correctly, It was then merged incorrectly.

How should we resolve this? The patch has to be pulled via a separate
branch, based on top of linus/master, as cmason/for-linus does not have
the clashing freezer patches. And I do want to see the fix in master
rather soon as it makes testing tedious.

david

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol
  2012-08-08 15:20     ` David Sterba
@ 2012-08-08 15:40       ` Chris Mason
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Mason @ 2012-08-08 15:40 UTC (permalink / raw)
  To: David Sterba; +Cc: Alexander Block, Josef Bacik, linux-btrfs@vger.kernel.org

On Wed, Aug 08, 2012 at 09:20:59AM -0600, David Sterba wrote:
> On Sat, Aug 04, 2012 at 01:39:25AM +0200, Alexander Block wrote:
> > On Fri, Aug 3, 2012 at 11:13 PM, Josef Bacik <jbacik@fusionio.com> wrote:
> > > I'm confused, this isn't here in btrfs-next, so is this a problem still?
> >
> > It's in linus current master. Lio Bo moved the call out of
> > btrfs_mksubvol into the caller. Later a commit from Jan Kara tried to
> > move the call inside mksubvol below i_mutex. If I understand the logs
> > correctly, It was then merged incorrectly.
> 
> How should we resolve this? The patch has to be pulled via a separate
> branch, based on top of linus/master, as cmason/for-linus does not have
> the clashing freezer patches. And I do want to see the fix in master
> rather soon as it makes testing tedious.

Right, I'll fix this up in a separate send to Linus.  I thought I had
this fixed in my original merge, but either way I'll send a pull to fix
it.

-chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-08 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-02 23:16 [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol Alexander Block
2012-08-03 21:13 ` Josef Bacik
2012-08-03 23:39   ` Alexander Block
2012-08-08 15:20     ` David Sterba
2012-08-08 15:40       ` Chris Mason

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).