From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 5/9] xfs: reinitialise recycled VFS inode correctly
Date: Mon, 8 Feb 2016 15:24:17 +1100 [thread overview]
Message-ID: <1454905461-2773-6-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1454905461-2773-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Now that we keep certain on-disk information in the VFS inode rather
than in a separate XFS specific stucture, we have to be careful of
the VFS code clearing that information when we re-initialise
reclaimable cached inodes during lookup. If we don't do this, then
we lose critical information from the inode and that results in
corruption being detected.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_icache.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 7c26f86..9ca28655 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -135,6 +135,26 @@ xfs_inode_free(
}
/*
+ * When we recycle a reclaimable inode, we need to re-initialise the VFS inode
+ * part of the structure. This is made more complex by the fact we store
+ * information about the on-disk values in the VFS inode and so we can't just
+ * overwrite it's values unconditionally. Hence we save the parameters we
+ * need to retain across reinitialisation, and rewrite them into the VFS inode
+ * after resetting it's state even if resetting fails.
+ */
+static int
+xfs_reinit_inode(
+ struct xfs_mount *mp,
+ struct inode *inode)
+{
+ int error;
+
+ error = inode_init_always(mp->m_super, inode);
+
+ return error;
+}
+
+/*
* Check the validity of the inode we just found it the cache
*/
static int
@@ -208,7 +228,7 @@ xfs_iget_cache_hit(
spin_unlock(&ip->i_flags_lock);
rcu_read_unlock();
- error = inode_init_always(mp->m_super, inode);
+ error = xfs_reinit_inode(mp, inode);
if (error) {
/*
* Re-initializing the inode failed, and we are in deep
--
2.5.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-02-08 4:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 4:24 [PATCH v3 0/9] xfs: gut the struct xfs_icdinode Dave Chinner
2016-02-08 4:24 ` [PATCH 1/9] xfs: introduce inode log format object Dave Chinner
2016-02-08 9:23 ` Christoph Hellwig
2016-02-08 19:28 ` Dave Chinner
2016-02-08 4:24 ` [PATCH 2/9] xfs: remove timestamps from incore inode Dave Chinner
2016-02-08 9:28 ` Christoph Hellwig
2016-02-08 4:24 ` [PATCH 3/9] xfs: cull unnecessary icdinode fields Dave Chinner
2016-02-08 9:29 ` Christoph Hellwig
2016-02-08 15:29 ` Brian Foster
2016-02-08 4:24 ` [PATCH 4/9] xfs: move v1 inode conversion to xfs_inode_from_disk Dave Chinner
2016-02-08 9:31 ` Christoph Hellwig
2016-02-08 19:44 ` Dave Chinner
2016-02-08 4:24 ` Dave Chinner [this message]
2016-02-08 9:33 ` [PATCH 5/9] xfs: reinitialise recycled VFS inode correctly Christoph Hellwig
2016-02-08 15:29 ` Brian Foster
2016-02-08 4:24 ` [PATCH 6/9] xfs: use vfs inode nlink field everywhere Dave Chinner
2016-02-08 9:40 ` Christoph Hellwig
2016-02-08 19:47 ` Dave Chinner
2016-02-08 15:29 ` Brian Foster
2016-02-08 4:24 ` [PATCH 7/9] xfs: move inode generation count to VFS inode Dave Chinner
2016-02-08 9:40 ` Christoph Hellwig
2016-02-08 15:29 ` Brian Foster
2016-02-08 4:24 ` [PATCH 8/9] xfs: move di_changecount " Dave Chinner
2016-02-08 9:41 ` Christoph Hellwig
2016-02-08 4:24 ` [PATCH 9/9] xfs: mode di_mode to vfs inode Dave Chinner
2016-02-08 9:42 ` Christoph Hellwig
2016-02-08 19:50 ` Dave Chinner
2016-02-08 15:29 ` Brian Foster
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=1454905461-2773-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 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.