From: Carlos Maiolino <cmaiolino@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 1/6] xfs: Fix m_agirotor reset during AG selection
Date: Wed, 19 Sep 2012 03:11:00 -0300 [thread overview]
Message-ID: <1348035065-6934-2-git-send-email-cmaiolino@redhat.com> (raw)
In-Reply-To: <1348035065-6934-1-git-send-email-cmaiolino@redhat.com>
xfs_ialloc_next_ag() currently resets m_agirotor when it is equal to m_maxagi:
if (++mp->m_agirotor == mp->m_maxagi)
mp->m_agirotor = 0;
But, if for some reason mp->m_maxagi changes to a lower value than current
m_agirotor, this condition will never be true, causing m_agirotor to exceed the
maximum allowed value (m_maxagi).
This implies mainly during lookups for xfs_perag structs in its radix tree,
since the agno value used for the lookup is based on m_agirotor. An out-of-range
m_agirotor may cause a lookup failure which in case will return NULL.
As an example, the value of m_maxagi is decreased during inode64->inode32
remount process, case where I've found this problem.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_ialloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 5aceb3f..445bf1a 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -431,7 +431,7 @@ xfs_ialloc_next_ag(
spin_lock(&mp->m_agirotor_lock);
agno = mp->m_agirotor;
- if (++mp->m_agirotor == mp->m_maxagi)
+ if (++mp->m_agirotor >= mp->m_maxagi)
mp->m_agirotor = 0;
spin_unlock(&mp->m_agirotor_lock);
--
1.7.11.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-09-19 6:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 6:10 [PATCH 0/6 V3] inode32/inode64 allocation changes Carlos Maiolino
2012-09-19 6:11 ` Carlos Maiolino [this message]
2012-09-19 6:11 ` [PATCH 2/6] xfs: make inode64 as the default allocation mode Carlos Maiolino
2012-09-19 6:11 ` [PATCH 3/6] xfs: reduce code duplication handling inode32/64 options Carlos Maiolino
2012-09-19 6:11 ` [PATCH 4/6] xfs: Fix mp->m_maxagi update during inode64 remount Carlos Maiolino
2012-09-19 6:11 ` [PATCH 5/6] xfs: add inode64->inode32 transition into xfs_set_inode32() Carlos Maiolino
2012-09-19 6:11 ` [PATCH 6/6] xfs: Make inode32 a remountable option Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2012-09-20 13:32 [PATCH 0/6 V4] inode32/inode64 allocation changes Carlos Maiolino
2012-09-20 13:32 ` [PATCH 1/6] xfs: Fix m_agirotor reset during AG selection Carlos Maiolino
2012-09-25 9:34 ` Christoph Hellwig
2012-09-26 20:19 ` Mark Tinguely
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=1348035065-6934-2-git-send-email-cmaiolino@redhat.com \
--to=cmaiolino@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox