diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-06-04 22:27:38 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:47:53 -0400 |
commit | 5ccb4a78d8c0e27985afec32cc4894d48e7b876e (patch) | |
tree | 9f02b4f89011b45a21768f9b52c9822ce7cc7497 /fs/minix | |
parent | 01cd9fef6eb3caae06415861de5b53224b722549 (diff) |
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')
-rw-r--r-- | fs/minix/bitmap.c | 6 | ||||
-rw-r--r-- | fs/minix/inode.c | 15 |
2 files changed, 12 insertions, 9 deletions
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index 482779fe4e7c..3f32bcb0d9bd 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c | |||
@@ -200,13 +200,13 @@ void minix_free_inode(struct inode * inode) | |||
200 | ino = inode->i_ino; | 200 | ino = inode->i_ino; |
201 | if (ino < 1 || ino > sbi->s_ninodes) { | 201 | if (ino < 1 || ino > sbi->s_ninodes) { |
202 | printk("minix_free_inode: inode 0 or nonexistent inode\n"); | 202 | printk("minix_free_inode: inode 0 or nonexistent inode\n"); |
203 | goto out; | 203 | return; |
204 | } | 204 | } |
205 | bit = ino & ((1<<k) - 1); | 205 | bit = ino & ((1<<k) - 1); |
206 | ino >>= k; | 206 | ino >>= k; |
207 | if (ino >= sbi->s_imap_blocks) { | 207 | if (ino >= sbi->s_imap_blocks) { |
208 | printk("minix_free_inode: nonexistent imap in superblock\n"); | 208 | printk("minix_free_inode: nonexistent imap in superblock\n"); |
209 | goto out; | 209 | return; |
210 | } | 210 | } |
211 | 211 | ||
212 | minix_clear_inode(inode); /* clear on-disk copy */ | 212 | minix_clear_inode(inode); /* clear on-disk copy */ |
@@ -217,8 +217,6 @@ void minix_free_inode(struct inode * inode) | |||
217 | printk("minix_free_inode: bit %lu already cleared\n", bit); | 217 | printk("minix_free_inode: bit %lu already cleared\n", bit); |
218 | spin_unlock(&bitmap_lock); | 218 | spin_unlock(&bitmap_lock); |
219 | mark_buffer_dirty(bh); | 219 | mark_buffer_dirty(bh); |
220 | out: | ||
221 | clear_inode(inode); /* clear in-memory copy */ | ||
222 | } | 220 | } |
223 | 221 | ||
224 | struct inode *minix_new_inode(const struct inode *dir, int mode, int *error) | 222 | struct inode *minix_new_inode(const struct inode *dir, int mode, int *error) |
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, | |||
24 | static int minix_statfs(struct dentry *dentry, struct kstatfs *buf); | 24 | static int minix_statfs(struct dentry *dentry, struct kstatfs *buf); |
25 | static int minix_remount (struct super_block * sb, int * flags, char * data); | 25 | static int minix_remount (struct super_block * sb, int * flags, char * data); |
26 | 26 | ||
27 | static void minix_delete_inode(struct inode *inode) | 27 | static void minix_evict_inode(struct inode *inode) |
28 | { | 28 | { |
29 | truncate_inode_pages(&inode->i_data, 0); | 29 | truncate_inode_pages(&inode->i_data, 0); |
30 | inode->i_size = 0; | 30 | if (!inode->i_nlink) { |
31 | minix_truncate(inode); | 31 | inode->i_size = 0; |
32 | minix_free_inode(inode); | 32 | minix_truncate(inode); |
33 | } | ||
34 | invalidate_inode_buffers(inode); | ||
35 | end_writeback(inode); | ||
36 | if (!inode->i_nlink) | ||
37 | minix_free_inode(inode); | ||
33 | } | 38 | } |
34 | 39 | ||
35 | static void minix_put_super(struct super_block *sb) | 40 | static void minix_put_super(struct super_block *sb) |
@@ -96,7 +101,7 @@ static const struct super_operations minix_sops = { | |||
96 | .alloc_inode = minix_alloc_inode, | 101 | .alloc_inode = minix_alloc_inode, |
97 | .destroy_inode = minix_destroy_inode, | 102 | .destroy_inode = minix_destroy_inode, |
98 | .write_inode = minix_write_inode, | 103 | .write_inode = minix_write_inode, |
99 | .delete_inode = minix_delete_inode, | 104 | .evict_inode = minix_evict_inode, |
100 | .put_super = minix_put_super, | 105 | .put_super = minix_put_super, |
101 | .statfs = minix_statfs, | 106 | .statfs = minix_statfs, |
102 | .remount_fs = minix_remount, | 107 | .remount_fs = minix_remount, |