* [PATCH] fs: fix buffer invalidation in invalidate_list
@ 2010-10-23 17:07 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2010-10-23 17:07 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel
We must not call invalidate_inode_buffers in invalidate_list unless the
inode can be reclaimed. If we remove the buffer association of a busy
inode fsync won't find the buffers anymore. As invalidate_inode_buffers
is called from various others sources than umount this actually does
matter in practice.
While at it change the loop to a more natural form and remove the
WARN_ON for I_NEW, wich we already tested a few lines above.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/inode.c
===================================================================
--- linux-2.6.orig/fs/inode.c 2010-10-23 18:57:45.404003756 +0200
+++ linux-2.6/fs/inode.c 2010-10-23 18:59:39.988021706 +0200
@@ -28,7 +28,6 @@
/*
* This is needed for the following functions:
* - inode_has_buffers
- * - invalidate_inode_buffers
* - invalidate_bdev
*
* FIXME: remove all knowledge of the buffer layer from this file
@@ -503,16 +502,15 @@ static int invalidate_list(struct list_h
inode = list_entry(tmp, struct inode, i_sb_list);
if (inode->i_state & I_NEW)
continue;
- invalidate_inode_buffers(inode);
- if (!atomic_read(&inode->i_count)) {
- list_move(&inode->i_list, dispose);
- WARN_ON(inode->i_state & I_NEW);
- inode->i_state |= I_FREEING;
- if (!(inode->i_state & (I_DIRTY | I_SYNC)))
- percpu_counter_dec(&nr_inodes_unused);
+ if (atomic_read(&inode->i_count)) {
+ busy = 1;
continue;
}
- busy = 1;
+
+ list_move(&inode->i_list, dispose);
+ inode->i_state |= I_FREEING;
+ if (!(inode->i_state & (I_DIRTY | I_SYNC)))
+ percpu_counter_dec(&nr_inodes_unused);
}
return busy;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-23 17:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-23 17:07 [PATCH] fs: fix buffer invalidation in invalidate_list Christoph Hellwig
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).