public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Ajeet Yadav <ajeet.yadav.77@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: XFS handling of synchronous buffers in case of EIO error
Date: Fri, 31 Dec 2010 10:13:53 +1100	[thread overview]
Message-ID: <20101230231353.GC15179@dastard> (raw)
In-Reply-To: <AANLkTi=Tmh9m_Rwy-bUZQEzcZ3M+6X9tZxFMO-J2Rvec@mail.gmail.com>

On Thu, Dec 30, 2010 at 05:58:36PM +0530, Ajeet Yadav wrote:
> Kernel: 2.6.30.9
> 
> I am trouble shooting a hang in XFS during umount.
> Test scenerio: Copy large number of files files using below script, and
> remove the USB after 3-5 second

FWIW, in future can you please report what kernel you are testing on?

> 
> index=0
> while [ "$?" == 0 ]
> do
>         index=$((index+1))
>         sync
>         cp $1/1KB.txt $2/"$index".test
> done
> 
> In rare scenerio during USB unplug the umount process hang at xfs_buf_lock.
> Below log shows the hung process
> 
> We have put printk to buffer handling functions xfs_buf_iodone_callbacks(),
> xfs_buf_error_relse(), xfs_buf_relse() and xfs_buf_rele()
> 
> We always observed the hang only comes when bp->b_relse =
> xfs_buf_error_relse(). i.e when xfs_buf_iodone_callbacks() execute
> XFS_BUF_SET_BRELSE_FUNC(bp,xfs_buf_error_relse);
> XFS_BUF_DONE(bp);
> XFS_BUF_FINISH_IOWAIT(bp);
> 
>  buf its never called by xfs_buf_relse() because b_hold = 3.
> 
> Also we have seen that this problem always comes when bp->relse != NULL &&
> bp->hold > 1.

This appears to be the same problem as reported here:

http://oss.sgi.com/archives/xfs/2010-12/msg00380.html


> I do not know whether below prints will help you, but I have taken printk
> for super block buffer tracing
> S-functionname ( Start of function)
> E-functionname (End of function)

If you have a recent enough kernel, you can get all this information
from the tracing built into XFS.

As it is, the cause of the problem is that setting bp->b_relse
changes the behaviour of xfs_buf_relse() - if bp->b_relse is set, it
doesn't unlock the buffer. This is normally just fine, because
xfs_buf_rele() has a special case to handle buffers with
bp->b_relse(), which adds a hold count and call the release function
when the hold count drops to zero. The b_relse function is supposed
to unlock the buffer by calling xfs_buf_relse() again.

Unfortunately, the superblock buffer is special - the hold count on
it never drops to zero until very late in the unmont process because
it is managed by the filesystem.  Hence the bp->b_relse function is
never called, and hence the buffer is never unlocked in this case.
Hence future attempts to access it hang.

I'll need to think about this one for a bit...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2010-12-30 23:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-30 12:28 XFS handling of synchronous buffers in case of EIO error Ajeet Yadav
2010-12-30 23:13 ` Dave Chinner [this message]
2010-12-31  6:47   ` Ajeet Yadav
2011-01-04  5:19     ` Dave Chinner
2011-01-05  8:26       ` Ajeet Yadav

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=20101230231353.GC15179@dastard \
    --to=david@fromorbit.com \
    --cc=ajeet.yadav.77@gmail.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