diff mbox

Btrfs: reset path lock state to zero

Message ID 1356687199-7198-1-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo Dec. 28, 2012, 9:33 a.m. UTC
We forgot to reset the path lock state to zero after we unlock the path block,
and this can lead to the ASSERT checker in tree unlock API.

Reported-by: Slava Barinov <rayslava@gmail.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/extent-tree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Mitch Harder Dec. 28, 2012, 6:32 p.m. UTC | #1
On Fri, Dec 28, 2012 at 3:33 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> We forgot to reset the path lock state to zero after we unlock the path block,
> and this can lead to the ASSERT checker in tree unlock API.
>
> Reported-by: Slava Barinov <rayslava@gmail.com>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
>  fs/btrfs/extent-tree.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 521e9d4..a71d457 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -6788,11 +6788,13 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
>                                                        &wc->flags[level]);
>                         if (ret < 0) {
>                                 btrfs_tree_unlock_rw(eb, path->locks[level]);
> +                               path->locks[level] = 0;
>                                 return ret;
>                         }
>                         BUG_ON(wc->refs[level] == 0);
>                         if (wc->refs[level] == 1) {
>                                 btrfs_tree_unlock_rw(eb, path->locks[level]);
> +                               path->locks[level] = 0;
>                                 return 1;
>                         }
>                 }
> --
> 1.7.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

This patch seems to clear a lock WARNING I've been seeing recently.

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/21692

I'm unable to generate the WARNING after applying this patch.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Liu Bo Dec. 29, 2012, 3:06 p.m. UTC | #2
On Fri, Dec 28, 2012 at 12:32:25PM -0600, Mitch Harder wrote:
> On Fri, Dec 28, 2012 at 3:33 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> > We forgot to reset the path lock state to zero after we unlock the path block,
> > and this can lead to the ASSERT checker in tree unlock API.
> >
> > Reported-by: Slava Barinov <rayslava@gmail.com>
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> >  fs/btrfs/extent-tree.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> > index 521e9d4..a71d457 100644
> > --- a/fs/btrfs/extent-tree.c
> > +++ b/fs/btrfs/extent-tree.c
> > @@ -6788,11 +6788,13 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
> >                                                        &wc->flags[level]);
> >                         if (ret < 0) {
> >                                 btrfs_tree_unlock_rw(eb, path->locks[level]);
> > +                               path->locks[level] = 0;
> >                                 return ret;
> >                         }
> >                         BUG_ON(wc->refs[level] == 0);
> >                         if (wc->refs[level] == 1) {
> >                                 btrfs_tree_unlock_rw(eb, path->locks[level]);
> > +                               path->locks[level] = 0;
> >                                 return 1;
> >                         }
> >                 }
> > --
> > 1.7.7.6
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> This patch seems to clear a lock WARNING I've been seeing recently.
> 
> http://permalink.gmane.org/gmane.comp.file-systems.btrfs/21692
> 
> I'm unable to generate the WARNING after applying this patch.

Good, they are related judging from your stack info :)

thanks,
liubo
> 
> Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 521e9d4..a71d457 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6788,11 +6788,13 @@  static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
 						       &wc->flags[level]);
 			if (ret < 0) {
 				btrfs_tree_unlock_rw(eb, path->locks[level]);
+				path->locks[level] = 0;
 				return ret;
 			}
 			BUG_ON(wc->refs[level] == 0);
 			if (wc->refs[level] == 1) {
 				btrfs_tree_unlock_rw(eb, path->locks[level]);
+				path->locks[level] = 0;
 				return 1;
 			}
 		}