All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <waiman.long@hp.com>
To: Dave Chinner <david@fromorbit.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: Thu, 23 Apr 2015 13:14:40 -0400	[thread overview]
Message-ID: <55392880.30301@hp.com> (raw)
In-Reply-To: <20150422231758.GQ21261@dastard>

On 04/22/2015 07:17 PM, Dave Chinner wrote:
> -- 
> Dave Chinner
> david@fromorbit.com
>
> xfs: xfs_attr_inactive leaves inconsistent attr fork state behind
>
> From: Dave Chinner<dchinner@redhat.com>
>
> xfs_attr_inactive() is supposed to clean up the attribute fork when
> the inode is being freed. While it removes attribute fork extents,
> it completely ignores attributes in local format, which means that
> there can still be active attributes on the inode after
> xfs_attr_inactive() has run.
>
> This leads to problems with concurrent inode writeback - the in-core
> inode attribute fork is removed without locking on the assumption
> that nothing will be attempting to access the attribute fork after a
> call to xfs_attr_inactive() because it isn't supposed to exist on
> disk any more.
>
> To fix this, make xfs_attr_inactive() completely remove all traces
> of the attribute fork from the inode, regardless of it's state.
> Further, also remove the in-core attribute fork structure safely so
> that there is nothing further that needs to be done by callers to
> clean up the attribute fork. This means we can remove the in-core
> and on-disk attribute forks atomically.
>
> Also, on error simply remove the in-memory attribute fork. There's
> nothing that can be done with it once we have failed to remove the
> on-disk attribute fork, so we may as well just blow it away here
> anyway.
>
> cc:<stable@vger.kernel.org>  # 3.12 to 4.0
> Reported-by: Waiman Long<waiman.long@hp.com>
> Signed-off-by: Dave Chinner<dchinner@redhat.com>
> ---
>   fs/xfs/libxfs/xfs_attr_leaf.c |  2 +-
>   fs/xfs/libxfs/xfs_attr_leaf.h |  2 +-
>   fs/xfs/xfs_attr_inactive.c    | 81 ++++++++++++++++++++++++++-----------------
>   fs/xfs/xfs_inode.c            | 12 +++----
>   4 files changed, 55 insertions(+), 42 deletions(-)

Thanks for figuring out a better way to fix the underlying problem. I 
tested it in my test machine and it did fix the errors that I had seen 
in my test case.

Tested-by: Waiman Long<Waiman.Long@hp.com>

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: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: call xfs_idestroy_fork() in xfs_ilock() critical section
Date: Thu, 23 Apr 2015 13:14:40 -0400	[thread overview]
Message-ID: <55392880.30301@hp.com> (raw)
In-Reply-To: <20150422231758.GQ21261@dastard>

On 04/22/2015 07:17 PM, Dave Chinner wrote:
> -- 
> Dave Chinner
> david@fromorbit.com
>
> xfs: xfs_attr_inactive leaves inconsistent attr fork state behind
>
> From: Dave Chinner<dchinner@redhat.com>
>
> xfs_attr_inactive() is supposed to clean up the attribute fork when
> the inode is being freed. While it removes attribute fork extents,
> it completely ignores attributes in local format, which means that
> there can still be active attributes on the inode after
> xfs_attr_inactive() has run.
>
> This leads to problems with concurrent inode writeback - the in-core
> inode attribute fork is removed without locking on the assumption
> that nothing will be attempting to access the attribute fork after a
> call to xfs_attr_inactive() because it isn't supposed to exist on
> disk any more.
>
> To fix this, make xfs_attr_inactive() completely remove all traces
> of the attribute fork from the inode, regardless of it's state.
> Further, also remove the in-core attribute fork structure safely so
> that there is nothing further that needs to be done by callers to
> clean up the attribute fork. This means we can remove the in-core
> and on-disk attribute forks atomically.
>
> Also, on error simply remove the in-memory attribute fork. There's
> nothing that can be done with it once we have failed to remove the
> on-disk attribute fork, so we may as well just blow it away here
> anyway.
>
> cc:<stable@vger.kernel.org>  # 3.12 to 4.0
> Reported-by: Waiman Long<waiman.long@hp.com>
> Signed-off-by: Dave Chinner<dchinner@redhat.com>
> ---
>   fs/xfs/libxfs/xfs_attr_leaf.c |  2 +-
>   fs/xfs/libxfs/xfs_attr_leaf.h |  2 +-
>   fs/xfs/xfs_attr_inactive.c    | 81 ++++++++++++++++++++++++++-----------------
>   fs/xfs/xfs_inode.c            | 12 +++----
>   4 files changed, 55 insertions(+), 42 deletions(-)

Thanks for figuring out a better way to fix the underlying problem. I 
tested it in my test machine and it did fix the errors that I had seen 
in my test case.

Tested-by: Waiman Long<Waiman.Long@hp.com>

Cheers,
Longman


  parent reply	other threads:[~2015-04-23 17:15 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
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 [this message]
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=55392880.30301@hp.com \
    --to=waiman.long@hp.com \
    --cc=david@fromorbit.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.