Btrfs: remove mnt_want_write call in btrfs_mksubvol
PATCH 1/1 Btrfs: remove mnt_want_write call in btrfs_mksubvol
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.
--- fs/btrfs/ioctl.c | 5 ----- 1 file changed, 5 deletions(-)
fs/btrfs/ioctl.c +0 -5
@@ -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; }
Signature · 1 line
1.7.10.4
Quoted 31 lines · 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_writecall frombtrfs_mksubvoland added a replacement call tomnt_want_write_fileinbtrfs_ioctl_snap_create_transid. Commite7848683however tried to move all calls tomnt_want_writeabovei_mutex. So somewhere while merging this, it got mixed up. The solution is to remove themnt_want_writecall completely from mksubvol.Reported-by David Sterba <[email protected]>Signed-off-by Alexander Block <[email protected]>--- fs/btrfs/ioctl.c | 5 ----- 1 file changed, 5 deletions(-)fs/btrfs/ioctl.c +0
-4@@ -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);
fs/btrfs/ioctl.c out_dput: · line 704
Quoted 7 lines
fs/btrfs/ioctl.c +0
-1@@ -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
Quoted 30 lines · Josef Bacik
Quoted 29 lines · 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_writecall frombtrfs_mksubvoland added a replacement call tomnt_want_write_fileinbtrfs_ioctl_snap_create_transid. Commite7848683however tried to move all calls tomnt_want_writeabovei_mutex. So somewhere while merging this, it got mixed up. The solution is to remove themnt_want_writecall completely from mksubvol.Reported-by David Sterba <[email protected]>Signed-off-by Alexander Block <[email protected]>--- fs/btrfs/ioctl.c | 5 ----- 1 file changed, 5 deletions(-)fs/btrfs/ioctl.c +0
-4@@ -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 );
Quoted 11 lines
fs/btrfs/ioctl.c out_dput: · line 704
Quoted 9 lines
fs/btrfs/ioctl.c +0
-1dentry =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.
Quoted 3 lines
Thanks,
Josef
Quoted 7 lines · Alexander Block
Quoted 1 line · Josef Bacik
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_mksubvolinto the caller. Later a commit from Jan Kara tried to move the call inside mksubvol belowi_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
Quoted 9 lines · David Sterba
Quoted 7 lines · Alexander Block
Quoted 1 line · Josef Bacik
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_mksubvolinto the caller. Later a commit from Jan Kara tried to move the call inside mksubvol belowi_mutex. If I understand the logs correctly, It was then merged incorrectly.
Quoted 4 lines
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