Skip to content

Commit f352064

Browse files
Russell KingAl Viro
authored andcommitted
fs/adfs: super: fix inode dropping
When we have write support enabled, we must not drop inodes before they have been written back, otherwise we lose updates to the filesystem on umount. Keep the inodes around unless we are built in read-only mode, or we are mounted read-only. Signed-off-by: Russell King <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent a464152 commit f352064

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/adfs/super.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ static void adfs_free_inode(struct inode *inode)
231231
kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
232232
}
233233

234+
static int adfs_drop_inode(struct inode *inode)
235+
{
236+
/* always drop inodes if we are read-only */
237+
return !IS_ENABLED(CONFIG_ADFS_FS_RW) || IS_RDONLY(inode);
238+
}
239+
234240
static void init_once(void *foo)
235241
{
236242
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
@@ -263,7 +269,7 @@ static void destroy_inodecache(void)
263269
static const struct super_operations adfs_sops = {
264270
.alloc_inode = adfs_alloc_inode,
265271
.free_inode = adfs_free_inode,
266-
.drop_inode = generic_delete_inode,
272+
.drop_inode = adfs_drop_inode,
267273
.write_inode = adfs_write_inode,
268274
.put_super = adfs_put_super,
269275
.statfs = adfs_statfs,

0 commit comments

Comments
 (0)