linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix how we discard outstanding ordered extents on abort
@ 2013-01-31 19:32 Josef Bacik
  2013-01-31 19:58 ` Zach Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2013-01-31 19:32 UTC (permalink / raw)
  To: linux-btrfs

When we abort we've been just free'ing up all the ordered extents and
hoping for the best.  This results in lots of warnings from various places,
warnings from btrfs_destroy_inode() because it's ENOSPC accounting isn't
fixed.  It will also screw up lots of pages who have been set private but
never get cleared because the ordered extents are never allowed to be
submitted.  This patch fixes those warnings.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/disk-io.c |   32 +++++++-------------------------
 1 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 42f83aa..63adf80 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3565,35 +3565,17 @@ static void btrfs_destroy_ordered_operations(struct btrfs_root *root)
 
 static void btrfs_destroy_ordered_extents(struct btrfs_root *root)
 {
-	struct list_head splice;
 	struct btrfs_ordered_extent *ordered;
 	struct inode *inode;
 
-	INIT_LIST_HEAD(&splice);
-
 	spin_lock(&root->fs_info->ordered_extent_lock);
-
-	list_splice_init(&root->fs_info->ordered_extents, &splice);
-	while (!list_empty(&splice)) {
-		ordered = list_entry(splice.next, struct btrfs_ordered_extent,
-				     root_extent_list);
-
-		list_del_init(&ordered->root_extent_list);
-		atomic_inc(&ordered->refs);
-
-		/* the inode may be getting freed (in sys_unlink path). */
-		inode = igrab(ordered->inode);
-
-		spin_unlock(&root->fs_info->ordered_extent_lock);
-		if (inode)
-			iput(inode);
-
-		atomic_set(&ordered->refs, 1);
-		btrfs_put_ordered_extent(ordered);
-
-		spin_lock(&root->fs_info->ordered_extent_lock);
-	}
-
+	/*
+	 * This will just short circuit the ordered completion stuff which will
+	 * make sure the ordered extent gets properly cleaned up.
+	 */
+	list_for_each_entry(ordered, &root->fs_info->ordered_extents,
+			    root_extent_list)
+		set_bit(BTRFS_ORDERED_IOERR, &ordered->flags);
 	spin_unlock(&root->fs_info->ordered_extent_lock);
 }
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: fix how we discard outstanding ordered extents on abort
  2013-01-31 19:32 [PATCH] Btrfs: fix how we discard outstanding ordered extents on abort Josef Bacik
@ 2013-01-31 19:58 ` Zach Brown
  2013-01-31 20:15   ` Josef Bacik
  0 siblings, 1 reply; 3+ messages in thread
From: Zach Brown @ 2013-01-31 19:58 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

> -	struct list_head splice;
>  	struct btrfs_ordered_extent *ordered;

>  	struct inode *inode;

Remove this too?

> +	/*
> +	 * This will just short circuit the ordered completion stuff which will
> +	 * make sure the ordered extent gets properly cleaned up.
> +	 */
> +	list_for_each_entry(ordered, &root->fs_info->ordered_extents,
> +			    root_extent_list)
> +		set_bit(BTRFS_ORDERED_IOERR, &ordered->flags);
>  	spin_unlock(&root->fs_info->ordered_extent_lock);
>  }

fs/btrfs/disk-io.c: In function ‘btrfs_destroy_ordered_extents’:
fs/btrfs/disk-io.c:3548:16: warning: unused variable ‘inode’ [-Wunused-variable]

- z

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: fix how we discard outstanding ordered extents on abort
  2013-01-31 19:58 ` Zach Brown
@ 2013-01-31 20:15   ` Josef Bacik
  0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2013-01-31 20:15 UTC (permalink / raw)
  To: Zach Brown; +Cc: Josef Bacik, linux-btrfs@vger.kernel.org

On Thu, Jan 31, 2013 at 12:58:08PM -0700, Zach Brown wrote:
> > -	struct list_head splice;
> >  	struct btrfs_ordered_extent *ordered;
> 
> >  	struct inode *inode;
> 
> Remove this too?
> 
> > +	/*
> > +	 * This will just short circuit the ordered completion stuff which will
> > +	 * make sure the ordered extent gets properly cleaned up.
> > +	 */
> > +	list_for_each_entry(ordered, &root->fs_info->ordered_extents,
> > +			    root_extent_list)
> > +		set_bit(BTRFS_ORDERED_IOERR, &ordered->flags);
> >  	spin_unlock(&root->fs_info->ordered_extent_lock);
> >  }
> 
> fs/btrfs/disk-io.c: In function ‘btrfs_destroy_ordered_extents’:
> fs/btrfs/disk-io.c:3548:16: warning: unused variable ‘inode’ [-Wunused-variable]
> 

Sigh I sent the wrong thing out, the one committed to my tree is right.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-31 20:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-31 19:32 [PATCH] Btrfs: fix how we discard outstanding ordered extents on abort Josef Bacik
2013-01-31 19:58 ` Zach Brown
2013-01-31 20:15   ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).