From: Mark Fasheh <mark.fasheh@oracle.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, hch@infradead.org
Subject: [RFC] [PATCH 1/2] move truncate_inode_pages() into ->delete_inode()
Date: Wed, 29 Jun 2005 11:49:37 -0700 [thread overview]
Message-ID: <20050629184937.GJ8215@ca-server1.us.oracle.com> (raw)
Allow file systems supporting ->delete_inode() to call
truncate_inode_pages() on their own. OCFS2 wants this so it can query
the cluster before making a final decision on whether to wipe an inode
from disk or not. In some corner cases an inode marked on the local
node via voting may not actually get orphaned. A good example is node
death before the transaction moving the inode to the orphan dir
commits to the journal. Without this patch, the truncate_inode_pages()
call in generic_delete_inode() would discard valid data for such
inodes.
During earlier discussion in the 2.6.13 merge plan thread, Christoph
Hellwig indicated that other file systems might also find this useful.
IMHO, the best solution would be to just allow ->drop_inode() to do
the cluster query but it seems that would require a substantial
reworking of that section of the code. Assuming it is safe to call
write_inode_now() in ocfs2_delete_inode() for those inodes which won't
actually get wiped, this solution should get us by for now.
Trivial testing of this patch (and a related OCFS2 update) has shown
this to avoid the corruption I'm seeing.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
--- linux-2.6.12.orig/fs/inode.c 2005-06-17 12:48:29.000000000 -0700
+++ linux-2.6.12/fs/inode.c 2005-06-28 16:18:52.559820000 -0700
@@ -992,19 +992,21 @@
inodes_stat.nr_inodes--;
spin_unlock(&inode_lock);
- if (inode->i_data.nrpages)
- truncate_inode_pages(&inode->i_data, 0);
-
security_inode_delete(inode);
if (op->delete_inode) {
void (*delete)(struct inode *) = op->delete_inode;
if (!is_bad_inode(inode))
DQUOT_INIT(inode);
- /* s_op->delete_inode internally recalls clear_inode() */
+ /* Filesystems implementing their own
+ * s_op->delete_inode are required to call
+ * truncate_inode_pages and clear_inode()
+ * internally */
delete(inode);
- } else
+ } else {
+ truncate_inode_pages(&inode->i_data, 0);
clear_inode(inode);
+ }
spin_lock(&inode_lock);
hlist_del_init(&inode->i_hash);
spin_unlock(&inode_lock);
next reply other threads:[~2005-06-29 18:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-29 18:49 Mark Fasheh [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-07-06 22:18 [RFC] [PATCH 1/2] move truncate_inode_pages() into ->delete_inode() Mark Fasheh
2005-07-07 13:04 ` 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=20050629184937.GJ8215@ca-server1.us.oracle.com \
--to=mark.fasheh@oracle.com \
--cc=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).