On Wed, Apr 02, 2014 at 05:41:10PM +0800, Liu Bo wrote:
> When we nearly run out of global_block_rsv's reserved space, this WARNING will
> be hit for thousands of times, which is not good because the kernel log has
> nothing else.
>
> ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes);
> - if (!WARN_ON(ret))
> + if (!WARN_ON_ONCE(ret))
> goto out;
The warning has been mistakenly added in
fae7f21cece9a4c181
"btrfs: Use WARN_ON()'s return value in place of WARN_ON(1)"
@@ -649,14 +649,13 @@ static int btrfs_delayed_inode_reserve_metadata(
goto out;
ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes);
- if (!ret)
+ if (!WARN_ON(ret))
goto out;
[previous WARN_ON removed a few lines below]
---
WARN_ON will trigger because it sees 'ret' though in the previous code
did not reach the WARN_ON below. The correct pattern is
- if (condition)
+ if (WARN_ON(condition))
I haven't spotted any other bugs from the same class in the patch. I'll
send a fix and cc stable.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html