summaryrefslogtreecommitdiffstats
path: root/fs/minix/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-06-05 04:27:38 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2010-08-09 22:47:53 +0200
commit5ccb4a78d8c0e27985afec32cc4894d48e7b876e (patch)
tree9f02b4f89011b45a21768f9b52c9822ce7cc7497 /fs/minix/inode.c
parentswitch sysfs to ->evict_inode() (diff)
downloadlinux-5ccb4a78d8c0e27985afec32cc4894d48e7b876e.tar.xz
linux-5ccb4a78d8c0e27985afec32cc4894d48e7b876e.zip
switch minix to ->evict_inode(), fix write_inode/delete_inode race
We need to wait for completion of possible writeback in progress before we clear on-disk inode during deletion. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/minix/inode.c')
-rw-r--r--fs/minix/inode.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 125062f55ef2..e39d6bf2e8fb 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -24,12 +24,17 @@ static int minix_write_inode(struct inode *inode,
static int minix_statfs(struct dentry *dentry, struct kstatfs *buf);
static int minix_remount (struct super_block * sb, int * flags, char * data);
-static void minix_delete_inode(struct inode *inode)
+static void minix_evict_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);
- inode->i_size = 0;
- minix_truncate(inode);
- minix_free_inode(inode);
+ if (!inode->i_nlink) {
+ inode->i_size = 0;
+ minix_truncate(inode);
+ }
+ invalidate_inode_buffers(inode);
+ end_writeback(inode);
+ if (!inode->i_nlink)
+ minix_free_inode(inode);
}
static void minix_put_super(struct super_block *sb)
@@ -96,7 +101,7 @@ static const struct super_operations minix_sops = {
.alloc_inode = minix_alloc_inode,
.destroy_inode = minix_destroy_inode,
.write_inode = minix_write_inode,
- .delete_inode = minix_delete_inode,
+ .evict_inode = minix_evict_inode,
.put_super = minix_put_super,
.statfs = minix_statfs,
.remount_fs = minix_remount,