All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <waiman.long@hp.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-kernel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: call xfs_idestroy_fork() in xfs_ilock() critical section
Date: Wed, 22 Apr 2015 16:28:38 -0400	[thread overview]
Message-ID: <55380476.3050509@hp.com> (raw)
In-Reply-To: <20150422191137.GF6688@bfoster.bfoster>

On 04/22/2015 03:11 PM, Brian Foster wrote:
> On Wed, Apr 22, 2015 at 01:33:41PM -0400, Waiman Long wrote:
>> The commit f7be2d7f594cbc ("xfs: push down inactive transaction
>> mgmt for truncate") refactored the xfs_inactive() function
>> in fs/xfs/xfs_inode.c.  However, it also moved the call to
>> xfs_idestroy_fork() from inside the xfs_ilock() critical section to
>> outside. That was causing memory corruption and strange failures like
>> deferencing NULL pointers in some circumstances.
>>
>> This patch moves the xfs_idestroy_fork() call back into an xfs_ilock()
>> critical section to avoid memory corruption problem.
>>
>> Signed-off-by: Waiman Long<Waiman.Long@hp.com>
>> ---
> Interesting... so from your previous mail we have an inactive/reclaim
> racing with an xfs_iflush_fork() of the attr fork, or something of that
> nature? Is there a specific reproducer or is it some kind of stress
> test?
>
> Good catch in any case, it looks like a deviation from the previous
> code...

I am not sure what kind of races are going on. I was running the AIM7 
workload for performance comparison purpose. I hit the error when 
running the disk workload with xfs filesystem. The smaller the ramdisk 
that I used, the easier it was to reproduce the error. I think I haven't 
run it for quite a while so I did not notice any problem or I might have 
just ignored it in some previous runs.

I did check some other call sites of xfs_idestroy_fork() and they are 
under xfs_ilock(). So I suppose it is not safe to call it outside of the 
critical section. This patch did indeed fix the problem that I saw when 
running the disk workload.

Cheers,
Longman


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

WARNING: multiple messages have this Message-ID (diff)
From: Waiman Long <waiman.long@hp.com>
To: Brian Foster <bfoster@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>,
	xfs@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: call xfs_idestroy_fork() in xfs_ilock() critical section
Date: Wed, 22 Apr 2015 16:28:38 -0400	[thread overview]
Message-ID: <55380476.3050509@hp.com> (raw)
In-Reply-To: <20150422191137.GF6688@bfoster.bfoster>

On 04/22/2015 03:11 PM, Brian Foster wrote:
> On Wed, Apr 22, 2015 at 01:33:41PM -0400, Waiman Long wrote:
>> The commit f7be2d7f594cbc ("xfs: push down inactive transaction
>> mgmt for truncate") refactored the xfs_inactive() function
>> in fs/xfs/xfs_inode.c.  However, it also moved the call to
>> xfs_idestroy_fork() from inside the xfs_ilock() critical section to
>> outside. That was causing memory corruption and strange failures like
>> deferencing NULL pointers in some circumstances.
>>
>> This patch moves the xfs_idestroy_fork() call back into an xfs_ilock()
>> critical section to avoid memory corruption problem.
>>
>> Signed-off-by: Waiman Long<Waiman.Long@hp.com>
>> ---
> Interesting... so from your previous mail we have an inactive/reclaim
> racing with an xfs_iflush_fork() of the attr fork, or something of that
> nature? Is there a specific reproducer or is it some kind of stress
> test?
>
> Good catch in any case, it looks like a deviation from the previous
> code...

I am not sure what kind of races are going on. I was running the AIM7 
workload for performance comparison purpose. I hit the error when 
running the disk workload with xfs filesystem. The smaller the ramdisk 
that I used, the easier it was to reproduce the error. I think I haven't 
run it for quite a while so I did not notice any problem or I might have 
just ignored it in some previous runs.

I did check some other call sites of xfs_idestroy_fork() and they are 
under xfs_ilock(). So I suppose it is not safe to call it outside of the 
critical section. This patch did indeed fix the problem that I saw when 
running the disk workload.

Cheers,
Longman



  reply	other threads:[~2015-04-22 20:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 17:33 [PATCH] xfs: call xfs_idestroy_fork() in xfs_ilock() critical section Waiman Long
2015-04-22 17:33 ` Waiman Long
2015-04-22 19:11 ` Brian Foster
2015-04-22 19:11   ` Brian Foster
2015-04-22 20:28   ` Waiman Long [this message]
2015-04-22 20:28     ` Waiman Long
2015-04-22 23:17 ` Dave Chinner
2015-04-22 23:17   ` Dave Chinner
2015-04-23 12:21   ` Brian Foster
2015-04-23 12:21     ` Brian Foster
2015-04-23 22:08     ` Dave Chinner
2015-04-23 22:08       ` Dave Chinner
2015-04-24 11:57       ` Brian Foster
2015-04-24 11:57         ` Brian Foster
2015-04-26 22:56         ` Dave Chinner
2015-04-26 22:56           ` Dave Chinner
2015-04-23 17:14   ` Waiman Long
2015-04-23 17:14     ` Waiman Long

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=55380476.3050509@hp.com \
    --to=waiman.long@hp.com \
    --cc=bfoster@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.