From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 5/5] XFS: Avoid using inodes that haven't been completely initialised
Date: Fri, 31 Oct 2008 12:15:29 +1100 [thread overview]
Message-ID: <1225415729-26514-6-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1225415729-26514-1-git-send-email-david@fromorbit.com>
The radix tree walks in xfs_sync_inodes_ag and xfs_qm_dqrele_all_inodes()
can find inodes that are still undergoing initialisation. Avoid
them by checking for the the XFS_INEW() flag once we have a reference
on the inode. This flag is cleared once the inode is properly initialised.
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
fs/xfs/linux-2.6/xfs_iops.c | 1 -
fs/xfs/linux-2.6/xfs_sync.c | 5 +++--
fs/xfs/quota/xfs_qm_syscalls.c | 6 ++++++
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index b7deff9..f131409 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -772,7 +772,6 @@ xfs_setup_inode(
inode->i_ino = ip->i_ino;
inode->i_state = I_NEW|I_LOCK;
inode_add_to_lists(ip->i_mount->m_super, inode);
- ASSERT(atomic_read(&inode->i_count) == 1);
inode->i_mode = ip->i_d.di_mode;
inode->i_nlink = ip->i_d.di_nlink;
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index fb5cca3..d12d31b 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -117,8 +117,9 @@ xfs_sync_inodes_ag(
}
read_unlock(&pag->pag_ici_lock);
- /* bad inodes are dealt with elsewhere */
- if (is_bad_inode(inode)) {
+ /* avoid new or bad inodes */
+ if (is_bad_inode(inode) ||
+ xfs_iflags_test(ip, XFS_INEW)) {
IRELE(ip);
continue;
}
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 2c57a6e..68139b3 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -1080,6 +1080,12 @@ xfs_qm_dqrele_inodes_ag(
}
read_unlock(&pag->pag_ici_lock);
+ /* avoid new inodes though we shouldn't find any here */
+ if (xfs_iflags_test(ip, XFS_INEW)) {
+ IRELE(ip);
+ continue;
+ }
+
xfs_ilock(ip, XFS_ILOCK_EXCL);
if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
xfs_qm_dqrele(ip->i_udquot);
--
1.5.6.5
next prev parent reply other threads:[~2008-10-31 1:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 1:15 [PATCH 0/5] Miscellaneous bug fixes Dave Chinner
2008-10-31 1:15 ` [PATCH 1/5] XFS: fix error inversion problems with data flushing Dave Chinner
2008-10-31 20:18 ` Christoph Hellwig
2008-11-02 22:51 ` Dave Chinner
2008-11-06 15:39 ` Christoph Hellwig
2008-10-31 1:15 ` [PATCH 2/5] XFS: Fix double free of log tickets Dave Chinner
2008-11-12 9:20 ` Christoph Hellwig
2008-10-31 1:15 ` [PATCH 3/5] XFS: fix uninitialised variable bug in dquot release Dave Chinner
2008-10-31 20:19 ` Christoph Hellwig
2008-10-31 1:15 ` [PATCH 4/5] XFS: fix spurious uninitialised variable warning in xfs_growfs_rt Dave Chinner
2008-10-31 20:20 ` Christoph Hellwig
2008-10-31 1:15 ` Dave Chinner [this message]
2008-10-31 20:21 ` [PATCH 5/5] XFS: Avoid using inodes that haven't been completely initialised Christoph Hellwig
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=1225415729-26514-6-git-send-email-david@fromorbit.com \
--to=david@fromorbit.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