diff options
author | Prasad Joshi <prasadjoshi.linux@gmail.com> | 2012-03-08 19:57:12 -0500 |
---|---|---|
committer | Prasad Joshi <prasadjoshi.linux@gmail.com> | 2012-04-01 23:50:33 -0400 |
commit | d2dcd9083f101584e029cbd4f0e1a4e573170d43 (patch) | |
tree | 1b64355958937bd425901f950342be58fa2a6286 /fs/logfs | |
parent | dd775ae2549217d3ae09363e3edb305d0fa19928 (diff) |
logfs: destroy the reserved inodes while unmounting
We were assuming that the evict_inode() would never be called on
reserved inodes. However, (after the commit 8e22c1a4e logfs: get rid
of magical inodes) while unmounting the file system, in put_super, we
call iput() on all of the reserved inodes.
The following simple test used to cause a kernel panic on LogFS:
1. Mount a LogFS file system on /mnt
2. Create a file
$ touch /mnt/a
3. Try to unmount the FS
$ umount /mnt
The simple fix would be to drop the assumption and properly destroy
the reserved inodes.
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Diffstat (limited to 'fs/logfs')
-rw-r--r-- | fs/logfs/inode.c | 16 | ||||
-rw-r--r-- | fs/logfs/readwrite.c | 1 | ||||
-rw-r--r-- | fs/logfs/segment.c | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c index a422f42238b2..df093d9e4da1 100644 --- a/fs/logfs/inode.c +++ b/fs/logfs/inode.c | |||
@@ -156,10 +156,26 @@ static void __logfs_destroy_inode(struct inode *inode) | |||
156 | call_rcu(&inode->i_rcu, logfs_i_callback); | 156 | call_rcu(&inode->i_rcu, logfs_i_callback); |
157 | } | 157 | } |
158 | 158 | ||
159 | static void __logfs_destroy_meta_inode(struct inode *inode) | ||
160 | { | ||
161 | struct logfs_inode *li = logfs_inode(inode); | ||
162 | BUG_ON(li->li_block); | ||
163 | call_rcu(&inode->i_rcu, logfs_i_callback); | ||
164 | } | ||
165 | |||
159 | static void logfs_destroy_inode(struct inode *inode) | 166 | static void logfs_destroy_inode(struct inode *inode) |
160 | { | 167 | { |
161 | struct logfs_inode *li = logfs_inode(inode); | 168 | struct logfs_inode *li = logfs_inode(inode); |
162 | 169 | ||
170 | if (inode->i_ino < LOGFS_RESERVED_INOS) { | ||
171 | /* | ||
172 | * The reserved inodes are never destroyed unless we are in | ||
173 | * unmont path. | ||
174 | */ | ||
175 | __logfs_destroy_meta_inode(inode); | ||
176 | return; | ||
177 | } | ||
178 | |||
163 | BUG_ON(list_empty(&li->li_freeing_list)); | 179 | BUG_ON(list_empty(&li->li_freeing_list)); |
164 | spin_lock(&logfs_inode_lock); | 180 | spin_lock(&logfs_inode_lock); |
165 | li->li_refcount--; | 181 | li->li_refcount--; |
diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c index e3ab5e5a904c..c8ea8664699c 100644 --- a/fs/logfs/readwrite.c +++ b/fs/logfs/readwrite.c | |||
@@ -2189,7 +2189,6 @@ void logfs_evict_inode(struct inode *inode) | |||
2189 | return; | 2189 | return; |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS); | ||
2193 | page = inode_to_page(inode); | 2192 | page = inode_to_page(inode); |
2194 | BUG_ON(!page); /* FIXME: Use emergency page */ | 2193 | BUG_ON(!page); /* FIXME: Use emergency page */ |
2195 | logfs_put_write_page(page); | 2194 | logfs_put_write_page(page); |
diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c index e28d090c98d6..038da0991794 100644 --- a/fs/logfs/segment.c +++ b/fs/logfs/segment.c | |||
@@ -886,7 +886,7 @@ static struct logfs_area *alloc_area(struct super_block *sb) | |||
886 | 886 | ||
887 | static void map_invalidatepage(struct page *page, unsigned long l) | 887 | static void map_invalidatepage(struct page *page, unsigned long l) |
888 | { | 888 | { |
889 | BUG(); | 889 | return; |
890 | } | 890 | } |
891 | 891 | ||
892 | static int map_releasepage(struct page *page, gfp_t g) | 892 | static int map_releasepage(struct page *page, gfp_t g) |