* [PATCH] Btrfs: use WARN_ON_ONCE instead for btrfs_invalidate_inodes
@ 2013-12-30 7:51 Liu Bo
2014-01-05 0:40 ` Josef Bacik
0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2013-12-30 7:51 UTC (permalink / raw)
To: linux-btrfs
So after transaction is aborted, we need to cleanup inode resources by
calling btrfs_invalidate_inodes(), and btrfs_invalidate_inodes() hopes
roots' refs to be zero in old times and sets a WARN_ON(), however, this
is not always true within cleaning up transaction, so WARN_ON_ONCE() is
better, and we won't get another syslog message bomb.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f1a7744..ef7f6af 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4761,7 +4761,7 @@ void btrfs_invalidate_inodes(struct btrfs_root *root)
struct inode *inode;
u64 objectid = 0;
- WARN_ON(btrfs_root_refs(&root->root_item) != 0);
+ WARN_ON_ONCE(btrfs_root_refs(&root->root_item) != 0);
spin_lock(&root->inode_lock);
again:
--
1.8.2.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: use WARN_ON_ONCE instead for btrfs_invalidate_inodes
2013-12-30 7:51 [PATCH] Btrfs: use WARN_ON_ONCE instead for btrfs_invalidate_inodes Liu Bo
@ 2014-01-05 0:40 ` Josef Bacik
2014-02-10 9:37 ` [PATCH v2] Btrfs: avoid warning bomb of btrfs_invalidate_inodes Liu Bo
0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2014-01-05 0:40 UTC (permalink / raw)
To: Liu Bo, linux-btrfs
On 12/30/2013 02:51 AM, Liu Bo wrote:
> So after transaction is aborted, we need to cleanup inode resources by
> calling btrfs_invalidate_inodes(), and btrfs_invalidate_inodes() hopes
> roots' refs to be zero in old times and sets a WARN_ON(), however, this
> is not always true within cleaning up transaction, so WARN_ON_ONCE() is
> better, and we won't get another syslog message bomb.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index f1a7744..ef7f6af 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4761,7 +4761,7 @@ void btrfs_invalidate_inodes(struct btrfs_root *root)
> struct inode *inode;
> u64 objectid = 0;
>
> - WARN_ON(btrfs_root_refs(&root->root_item) != 0);
> + WARN_ON_ONCE(btrfs_root_refs(&root->root_item) != 0);
>
> spin_lock(&root->inode_lock);
> again:
I'd rather just detect that we're cleaning up for an abort and not warn
at all. Thanks,
Josef
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] Btrfs: avoid warning bomb of btrfs_invalidate_inodes
2014-01-05 0:40 ` Josef Bacik
@ 2014-02-10 9:37 ` Liu Bo
0 siblings, 0 replies; 3+ messages in thread
From: Liu Bo @ 2014-02-10 9:37 UTC (permalink / raw)
To: linux-btrfs
So after transaction is aborted, we need to cleanup inode resources by
calling btrfs_invalidate_inodes(), and btrfs_invalidate_inodes() hopes
roots' refs to be zero in old times and sets a WARN_ON(), however, this
is not always true within cleaning up transaction, so we get to detect
transaction abortion and not warn at all.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: Follow Josef's advice, ie. in case of aborting transaction, we no more warn.
fs/btrfs/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1af34d0..e876c1e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4920,7 +4920,8 @@ void btrfs_invalidate_inodes(struct btrfs_root *root)
struct inode *inode;
u64 objectid = 0;
- WARN_ON(btrfs_root_refs(&root->root_item) != 0);
+ if (!test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state))
+ WARN_ON(btrfs_root_refs(&root->root_item) != 0);
spin_lock(&root->inode_lock);
again:
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-10 9:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-30 7:51 [PATCH] Btrfs: use WARN_ON_ONCE instead for btrfs_invalidate_inodes Liu Bo
2014-01-05 0:40 ` Josef Bacik
2014-02-10 9:37 ` [PATCH v2] Btrfs: avoid warning bomb of btrfs_invalidate_inodes 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).