* [PATCH] Btrfs: wake up extent state waiters on unlock through clear_extent_bits
@ 2015-05-14 19:41 Filipe Manana
2015-05-18 16:27 ` Liu Bo
0 siblings, 1 reply; 2+ messages in thread
From: Filipe Manana @ 2015-05-14 19:41 UTC (permalink / raw)
To: linux-btrfs; +Cc: ce3g8jdj, Filipe Manana
When we clear an extent state's EXTENT_LOCKED bit with clear_extent_bits()
through free_io_failure(), we weren't waking up any tasks waiting for the
extent's state EXTENT_LOCKED bit, leading to an hang.
So make sure clear_extent_bits() ends up waking up any waiters if the
bit EXTENT_LOCKED is supplied by its callers.
Zygo Blaxell was experiencing such hangs at inode eviction time after
file unlinks. Thanks to him for a set of scripts to reproduce the issue.
Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
fs/btrfs/extent_io.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index c32d226..856c2e8 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1277,7 +1277,12 @@ int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
unsigned bits, gfp_t mask)
{
- return clear_extent_bit(tree, start, end, bits, 0, 0, NULL, mask);
+ int wake = 0;
+
+ if (bits & EXTENT_LOCKED)
+ wake = 1;
+
+ return clear_extent_bit(tree, start, end, bits, wake, 0, NULL, mask);
}
int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
--
2.1.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: wake up extent state waiters on unlock through clear_extent_bits
2015-05-14 19:41 [PATCH] Btrfs: wake up extent state waiters on unlock through clear_extent_bits Filipe Manana
@ 2015-05-18 16:27 ` Liu Bo
0 siblings, 0 replies; 2+ messages in thread
From: Liu Bo @ 2015-05-18 16:27 UTC (permalink / raw)
To: Filipe Manana; +Cc: linux-btrfs, ce3g8jdj
On Thu, May 14, 2015 at 08:41:07PM +0100, Filipe Manana wrote:
> When we clear an extent state's EXTENT_LOCKED bit with clear_extent_bits()
> through free_io_failure(), we weren't waking up any tasks waiting for the
> extent's state EXTENT_LOCKED bit, leading to an hang.
>
> So make sure clear_extent_bits() ends up waking up any waiters if the
> bit EXTENT_LOCKED is supplied by its callers.
>
> Zygo Blaxell was experiencing such hangs at inode eviction time after
> file unlinks. Thanks to him for a set of scripts to reproduce the issue.
Good catch!
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Thanks,
-liubo
>
> Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> fs/btrfs/extent_io.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index c32d226..856c2e8 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -1277,7 +1277,12 @@ int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
> int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
> unsigned bits, gfp_t mask)
> {
> - return clear_extent_bit(tree, start, end, bits, 0, 0, NULL, mask);
> + int wake = 0;
> +
> + if (bits & EXTENT_LOCKED)
> + wake = 1;
> +
> + return clear_extent_bit(tree, start, end, bits, wake, 0, NULL, mask);
> }
>
> int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
> --
> 2.1.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-18 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-14 19:41 [PATCH] Btrfs: wake up extent state waiters on unlock through clear_extent_bits Filipe Manana
2015-05-18 16:27 ` Liu Bo
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).