All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] xfs: inode counter needs to use __percpu_counter_compare
Date: Wed,  6 May 2015 08:01:39 +1000	[thread overview]
Message-ID: <1430863299-9341-3-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1430863299-9341-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

From: Dave Chinner <dchinner@redhat.com>

Because the counter uses a custom batch size, the comparison
function needs to be aware of that batch size otherwise the
comparison does not work correctly. This leads to ASSERT failures
on generic/027 like this:

 XFS: Assertion failed: 0, file: fs/xfs/xfs_mount.c, line: 1099
 ------------[ cut here ]------------
....
 Call Trace:
  [<ffffffff81522a39>] xfs_mod_icount+0x99/0xc0
  [<ffffffff815285cb>] xfs_trans_unreserve_and_mod_sb+0x28b/0x5b0
  [<ffffffff8152f941>] xfs_log_commit_cil+0x321/0x580
  [<ffffffff81528e17>] xfs_trans_commit+0xb7/0x260
  [<ffffffff81503d4d>] xfs_bmap_finish+0xcd/0x1b0
  [<ffffffff8151da41>] xfs_inactive_ifree+0x1e1/0x250
  [<ffffffff8151dbe0>] xfs_inactive+0x130/0x200
  [<ffffffff81523a21>] xfs_fs_evict_inode+0x91/0xf0
  [<ffffffff811f3958>] evict+0xb8/0x190
  [<ffffffff811f433b>] iput+0x18b/0x1f0
  [<ffffffff811e8853>] do_unlinkat+0x1f3/0x320
  [<ffffffff811d548a>] ? filp_close+0x5a/0x80
  [<ffffffff811e999b>] SyS_unlinkat+0x1b/0x40
  [<ffffffff81e0892e>] system_call_fastpath+0x12/0x71

This is a regression introduced by commit 501ab32 ("xfs: use generic
percpu counters for inode counter").

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_mount.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 02f827f..900f8ce 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1106,8 +1106,9 @@ xfs_mod_icount(
 	int64_t			delta)
 {
 	/* deltas are +/-64, hence the large batch size of 128. */
-	__percpu_counter_add(&mp->m_icount, delta, 128);
-	if (percpu_counter_compare(&mp->m_icount, 0) < 0) {
+#define _ICOUNT_BATCH	128
+	__percpu_counter_add(&mp->m_icount, delta, _ICOUNT_BATCH);
+	if (__percpu_counter_compare(&mp->m_icount, 0, _ICOUNT_BATCH) < 0) {
 		ASSERT(0);
 		percpu_counter_add(&mp->m_icount, -delta);
 		return -EINVAL;
-- 
2.0.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] xfs: inode counter needs to use __percpu_counter_compare
Date: Wed,  6 May 2015 08:01:39 +1000	[thread overview]
Message-ID: <1430863299-9341-3-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1430863299-9341-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

From: Dave Chinner <dchinner@redhat.com>

Because the counter uses a custom batch size, the comparison
function needs to be aware of that batch size otherwise the
comparison does not work correctly. This leads to ASSERT failures
on generic/027 like this:

 XFS: Assertion failed: 0, file: fs/xfs/xfs_mount.c, line: 1099
 ------------[ cut here ]------------
....
 Call Trace:
  [<ffffffff81522a39>] xfs_mod_icount+0x99/0xc0
  [<ffffffff815285cb>] xfs_trans_unreserve_and_mod_sb+0x28b/0x5b0
  [<ffffffff8152f941>] xfs_log_commit_cil+0x321/0x580
  [<ffffffff81528e17>] xfs_trans_commit+0xb7/0x260
  [<ffffffff81503d4d>] xfs_bmap_finish+0xcd/0x1b0
  [<ffffffff8151da41>] xfs_inactive_ifree+0x1e1/0x250
  [<ffffffff8151dbe0>] xfs_inactive+0x130/0x200
  [<ffffffff81523a21>] xfs_fs_evict_inode+0x91/0xf0
  [<ffffffff811f3958>] evict+0xb8/0x190
  [<ffffffff811f433b>] iput+0x18b/0x1f0
  [<ffffffff811e8853>] do_unlinkat+0x1f3/0x320
  [<ffffffff811d548a>] ? filp_close+0x5a/0x80
  [<ffffffff811e999b>] SyS_unlinkat+0x1b/0x40
  [<ffffffff81e0892e>] system_call_fastpath+0x12/0x71

This is a regression introduced by commit 501ab32 ("xfs: use generic
percpu counters for inode counter").

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_mount.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 02f827f..900f8ce 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1106,8 +1106,9 @@ xfs_mod_icount(
 	int64_t			delta)
 {
 	/* deltas are +/-64, hence the large batch size of 128. */
-	__percpu_counter_add(&mp->m_icount, delta, 128);
-	if (percpu_counter_compare(&mp->m_icount, 0) < 0) {
+#define _ICOUNT_BATCH	128
+	__percpu_counter_add(&mp->m_icount, delta, _ICOUNT_BATCH);
+	if (__percpu_counter_compare(&mp->m_icount, 0, _ICOUNT_BATCH) < 0) {
 		ASSERT(0);
 		percpu_counter_add(&mp->m_icount, -delta);
 		return -EINVAL;
-- 
2.0.0


  parent reply	other threads:[~2015-05-05 22:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 22:01 [PATCH 0/2] xfs: fix inode count underrun Dave Chinner
2015-05-05 22:01 ` Dave Chinner
2015-05-05 22:01 ` [PATCH 1/2] percpu_counter: batch size aware __percpu_counter_compare() Dave Chinner
2015-05-05 22:01   ` Dave Chinner
2015-05-06  4:36   ` Christoph Hellwig
2015-05-06  4:36     ` Christoph Hellwig
2015-05-06  4:46     ` Christoph Hellwig
2015-05-06  4:46       ` Christoph Hellwig
2015-05-06  5:43     ` Dave Chinner
2015-05-06  5:43       ` Dave Chinner
2015-05-06  5:53       ` Dave Chinner
2015-05-06  5:53         ` Dave Chinner
2015-05-06  6:11         ` Dave Chinner
2015-05-06  6:11           ` Dave Chinner
2015-05-05 22:01 ` Dave Chinner [this message]
2015-05-05 22:01   ` [PATCH 2/2] xfs: inode counter needs to use __percpu_counter_compare Dave Chinner
2015-05-06  4:38   ` Christoph Hellwig
2015-05-06  4:38     ` Christoph Hellwig
2015-05-06  5:45     ` Dave Chinner
2015-05-06  5:45       ` 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=1430863299-9341-3-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.