public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jeff Liu <jeff.liu@oracle.com>
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: get new buffer for secondary superblocks from the first new AG
Date: Thu, 21 Mar 2013 16:44:28 +1100	[thread overview]
Message-ID: <20130321054428.GN17758@dastard> (raw)
In-Reply-To: <514A88C3.2030204@oracle.com>

On Thu, Mar 21, 2013 at 12:12:51PM +0800, Jeff Liu wrote:
> In growfs operation, the unused parts of superblocks in the latest old AG are
> zero filled, hence we can safely read the secondary superblock buffer of it
> rather than getting a new buffer for it again.

>From the code:

	oagcount = mp->m_sb.sb_agcount;

And because the AG indexes are zero numbered, the index of the
last original AGs is (oagcount - 1). Hence we shoul donly be reading
from the AG headers if the current AG index is less than oagcount.

> This is a small refinement for commits 1375cb65.
> 
> Cc: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---
>  fs/xfs/xfs_fsops.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 94eaeed..7d435dd 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -449,7 +449,7 @@ xfs_growfs_data_private(
>  		 * disk as the contents of the new area we are growing into is
>  		 * completely unknown.
>  		 */
> -		if (agno < oagcount) {
> +		if (agno <= oagcount) {

With this change, when agno == oagcount we are one AG beyond the
original filesystem size and so if we read that space, we are
reading uninitialised data.

AFAICT, the current code is correct...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-03-21  5:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21  4:12 [PATCH] xfs: get new buffer for secondary superblocks from the first new AG Jeff Liu
2013-03-21  5:44 ` Dave Chinner [this message]
2013-03-21  6:27   ` Jeff Liu

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=20130321054428.GN17758@dastard \
    --to=david@fromorbit.com \
    --cc=jeff.liu@oracle.com \
    --cc=xfs@oss.sgi.com \
    /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