All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] xfs: libxfs: move xfs_perag_put late
@ 2018-11-27  0:33 Pan Bian
  2018-11-27  9:16 ` Carlos Maiolino
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Bian @ 2018-11-27  0:33 UTC (permalink / raw)
  To: Darrick J. Wong, Brian Foster, Dave Chinner, Carlos Maiolino, linux-xfs
  Cc: linux-kernel, Pan Bian

The function xfs_alloc_get_freelist calls xfs_perag_put to drop the
reference. However, pag->pagf_btreeblks is read and write after the 
put operation. This patch moves the put operation late.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
V2: correct the commit log
---
 fs/xfs/libxfs/xfs_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index e1c0c0d..4be387d 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -2435,7 +2435,6 @@ xfs_alloc_get_freelist(
 	be32_add_cpu(&agf->agf_flcount, -1);
 	xfs_trans_agflist_delta(tp, -1);
 	pag->pagf_flcount--;
-	xfs_perag_put(pag);
 
 	logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
 	if (btreeblk) {
@@ -2443,6 +2442,7 @@ xfs_alloc_get_freelist(
 		pag->pagf_btreeblks++;
 		logflags |= XFS_AGF_BTREEBLKS;
 	}
+	xfs_perag_put(pag);
 
 	xfs_alloc_log_agf(tp, agbp, logflags);
 	*bnop = bno;
-- 
2.7.4



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

* Re: [PATCH V2] xfs: libxfs: move xfs_perag_put late
  2018-11-27  0:33 [PATCH V2] xfs: libxfs: move xfs_perag_put late Pan Bian
@ 2018-11-27  9:16 ` Carlos Maiolino
  2018-11-27 16:25   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Carlos Maiolino @ 2018-11-27  9:16 UTC (permalink / raw)
  To: Pan Bian
  Cc: Darrick J. Wong, Brian Foster, Dave Chinner, linux-xfs, linux-kernel

On Tue, Nov 27, 2018 at 08:33:38AM +0800, Pan Bian wrote:
> The function xfs_alloc_get_freelist calls xfs_perag_put to drop the
> reference. However, pag->pagf_btreeblks is read and write after the 
> put operation. This patch moves the put operation late.

I'm not a native English speaker too, but I believe it should be "is read and
written after..."

But, for the code itself, you can add:

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

Cheers

> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
> V2: correct the commit log
> ---
>  fs/xfs/libxfs/xfs_alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index e1c0c0d..4be387d 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2435,7 +2435,6 @@ xfs_alloc_get_freelist(
>  	be32_add_cpu(&agf->agf_flcount, -1);
>  	xfs_trans_agflist_delta(tp, -1);
>  	pag->pagf_flcount--;
> -	xfs_perag_put(pag);
>  
>  	logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
>  	if (btreeblk) {
> @@ -2443,6 +2442,7 @@ xfs_alloc_get_freelist(
>  		pag->pagf_btreeblks++;
>  		logflags |= XFS_AGF_BTREEBLKS;
>  	}
> +	xfs_perag_put(pag);
>  
>  	xfs_alloc_log_agf(tp, agbp, logflags);
>  	*bnop = bno;
> -- 
> 2.7.4
> 
> 

-- 
Carlos

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

* Re: [PATCH V2] xfs: libxfs: move xfs_perag_put late
  2018-11-27  9:16 ` Carlos Maiolino
@ 2018-11-27 16:25   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-11-27 16:25 UTC (permalink / raw)
  To: Pan Bian, Brian Foster, Dave Chinner, linux-xfs, linux-kernel

On Tue, Nov 27, 2018 at 10:16:02AM +0100, Carlos Maiolino wrote:
> On Tue, Nov 27, 2018 at 08:33:38AM +0800, Pan Bian wrote:
> > The function xfs_alloc_get_freelist calls xfs_perag_put to drop the
> > reference. However, pag->pagf_btreeblks is read and write after the 
> > put operation. This patch moves the put operation late.
> 
> I'm not a native English speaker too, but I believe it should be "is read and
> written after..."
> 
> But, for the code itself, you can add:
> 
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> 
> Cheers
> 
> > 
> > Signed-off-by: Pan Bian <bianpan2016@163.com>

Looks ok, will amend the changelog on the way in.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> > ---
> > V2: correct the commit log
> > ---
> >  fs/xfs/libxfs/xfs_alloc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> > index e1c0c0d..4be387d 100644
> > --- a/fs/xfs/libxfs/xfs_alloc.c
> > +++ b/fs/xfs/libxfs/xfs_alloc.c
> > @@ -2435,7 +2435,6 @@ xfs_alloc_get_freelist(
> >  	be32_add_cpu(&agf->agf_flcount, -1);
> >  	xfs_trans_agflist_delta(tp, -1);
> >  	pag->pagf_flcount--;
> > -	xfs_perag_put(pag);
> >  
> >  	logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
> >  	if (btreeblk) {
> > @@ -2443,6 +2442,7 @@ xfs_alloc_get_freelist(
> >  		pag->pagf_btreeblks++;
> >  		logflags |= XFS_AGF_BTREEBLKS;
> >  	}
> > +	xfs_perag_put(pag);
> >  
> >  	xfs_alloc_log_agf(tp, agbp, logflags);
> >  	*bnop = bno;
> > -- 
> > 2.7.4
> > 
> > 
> 
> -- 
> Carlos

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

end of thread, other threads:[~2018-11-27 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27  0:33 [PATCH V2] xfs: libxfs: move xfs_perag_put late Pan Bian
2018-11-27  9:16 ` Carlos Maiolino
2018-11-27 16:25   ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.