All of lore.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
Subject: Re: [PATCH] xfs: remote attribute overwrite causes transaction overrun
Date: Wed, 23 Apr 2014 10:00:42 +1000	[thread overview]
Message-ID: <20140423000042.GO18672@dastard> (raw)
In-Reply-To: <20140422234628.GN18672@dastard>

On Wed, Apr 23, 2014 at 09:46:28AM +1000, Dave Chinner wrote:
> On Tue, Apr 22, 2014 at 08:00:55PM +0800, Jeff Liu wrote:
> > 
> > On 04/22 2014 14:59 PM, Dave Chinner wrote:
> > > From: Dave Chinner <dchinner@redhat.com>
> > > 
> > > Commit e461fcb ("xfs: remote attribute lookups require the value
> > > length") passes the remote attribute length in the xfs_da_args
> > > structure on lookup so that CRC calculations and validity checking
> > > can be performed correctly by related code. This, unfortunately has
> > > the side effect of changing the args->valuelen parameter in cases
> > > where it shouldn't.
> > > 
> > > That is, when we replace a remote attribute, the incoming
> > > replacement stores the value and length in args->value and
> > > args->valuelen, but then the lookup which finds the existing remote
> > > attribute overwrites args->valuelen with the length of the remote
> > > attribute being replaced. Hence when we go to create the new
> > > attribute, we create it of the size of the existing remote
> > > attribute, not the size it is supposed to be. When the new attribute
> > > is much smaller than the old attribute, this results in a
> > > transaction overrun and an ASSERT() failure on a debug kernel:
> > > 
> > > XFS: Assertion failed: tp->t_blk_res_used <= tp->t_blk_res, file: fs/xfs/xfs_trans.c, line: 331
> > > 
> > > Fix this by keeping the remote attribute value length separate to
> > > the attribute value length in the xfs_da_args structure. The enables
> > > us to pass the length of the remote attribute to be removed without
> > > overwriting the new attribute's length.
> > > 
> > > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ....
> > > @@ -348,6 +348,11 @@ xfs_attr_rmtval_get(
> > >  
> > >  	ASSERT(!(args->flags & ATTR_KERNOVAL));
> > >  
> > > +	/* remote value might be different size to the buffer supplied. */
> > > +	if (args->rmtvaluelen = args->valuelen)
> > 			     ^^^
> > Here is a typo...
> 
> Oh, well spotted.
> 
> But, hold on a minute, shouldn't gcc be catching those sorts of
> typos?
> 
> /me groans
> 
> $ gcc t.c
> $ gcc -Wall t.c
> t.c: In function ¿main¿:
> t.c:10:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
>   if (foo = bar)
>   ^
> $
> 
> Only if -Wparentheses is specified.
> 
> Why the hell are we suppressing useful warnings on the kernel build?

Hmmm - looks like I missed the output of the warning when I built
against 3.15-rc2 because it was a rebuild the world and there's tons
of output when that happens...

<sigh>

Time to add ccflags-y += -Werror to the makefile....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2014-04-23  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22  6:59 [PATCH] xfs: remote attribute overwrite causes transaction overrun Dave Chinner
2014-04-22 12:00 ` Jeff Liu
2014-04-22 23:46   ` Dave Chinner
2014-04-23  0:00     ` Dave Chinner [this message]
2014-04-23  3:04       ` Eric Sandeen
2014-04-23  5:54         ` Dave Chinner
2014-04-23  2:13     ` Jeff Liu
2014-04-22 14:17 ` Brian Foster
2014-04-23  0:29   ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2015-04-29  1:55 [RFC PATCH] " Sheng Yong
2015-04-29  1:55 ` [PATCH] " Sheng Yong
2015-04-29  7:43   ` Dave Chinner
2015-04-29  9:05     ` Sheng Yong
2015-05-02 18:36       ` Greg KH
2015-05-04  1:45         ` Sheng Yong
2015-05-04  3:34           ` Dave Chinner

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=20140423000042.GO18672@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 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.