public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v2 1/3] xfs: add scan owner field to xfs_eofblocks
Date: Tue, 27 May 2014 08:49:21 +1000	[thread overview]
Message-ID: <20140526224921.GQ18954@dastard> (raw)
In-Reply-To: <1400845950-41435-2-git-send-email-bfoster@redhat.com>

On Fri, May 23, 2014 at 07:52:28AM -0400, Brian Foster wrote:
> The scan owner field represents an optional inode number that is
> responsible for the current scan. The purpose is to identify that an
> inode is under iolock and as such, the iolock shouldn't be attempted
> when trimming eofblocks. This is an internal only field.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
>  fs/xfs/xfs_icache.c | 12 +++++++++++-
>  fs/xfs/xfs_icache.h |  2 ++
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index c48df5f..f4191f6 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -1211,6 +1211,7 @@ xfs_inode_free_eofblocks(
>  {
>  	int ret;
>  	struct xfs_eofblocks *eofb = args;
> +	bool need_iolock = true;
>  
>  	if (!xfs_can_free_eofblocks(ip, false)) {
>  		/* inode could be preallocated or append-only */
> @@ -1235,9 +1236,18 @@ xfs_inode_free_eofblocks(
>  		if (eofb->eof_flags & XFS_EOF_FLAGS_MINFILESIZE &&
>  		    XFS_ISIZE(ip) < eofb->eof_min_file_size)
>  			return 0;
> +
> +		/*
> +		 * A scan owner implies we already hold the iolock. Skip it in
> +		 * xfs_free_eofblocks() to avoid deadlock. This also eliminates
> +		 * the possibility of EAGAIN being returned.
> +		 */
> +		if (eofb->eof_scan_owner != NULLFSINO &&
> +		    eofb->eof_scan_owner == ip->i_ino)
> +			need_iolock = false;

No need to check against NULLFSINO there. ip->i_ino can never be
NULLFSINO, so just checking eofb->eof_scan_owner == ip->i_ino is
sufficient.

What might be an idea is adding a

	ASSERT(eofb->eof_scan_owner != 0);

to the start of the function to catch anyone who does not initialise
it appropriately. The inode number can never be zero (that would
translate to block 0 - the primary superblock) and so this woul dbe
sufficient to ensure callers are doing the right thing....

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-05-26 22:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 11:52 [PATCH v2 0/3] xfs: run eofblocks scan on ENOSPC Brian Foster
2014-05-23 11:52 ` [PATCH v2 1/3] xfs: add scan owner field to xfs_eofblocks Brian Foster
2014-05-26 22:49   ` Dave Chinner [this message]
2014-05-27 10:44   ` Christoph Hellwig
2014-05-27 12:18     ` Brian Foster
2014-05-27 21:26       ` Dave Chinner
2014-05-28  5:30         ` Christoph Hellwig
2014-05-28 14:00           ` Brian Foster
2014-05-23 11:52 ` [PATCH v2 2/3] xfs: run an eofblocks scan on ENOSPC/EDQUOT Brian Foster
2014-05-26 22:57   ` Dave Chinner
2014-05-27 12:47     ` Brian Foster
2014-05-27 21:14       ` Dave Chinner
2014-05-28 12:42         ` Brian Foster
2014-05-23 11:52 ` [PATCH v2 3/3] xfs: squash prealloc while over quota free space as well Brian Foster
2014-05-26 23:00   ` 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=20140526224921.GQ18954@dastard \
    --to=david@fromorbit.com \
    --cc=bfoster@redhat.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