summaryrefslogtreecommitdiff
path: root/fs/adfs/super.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 11:11:18 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-20 20:12:42 -0500
commitf352064275adfeb6f88cb0fb25cc623750adf89f (patch)
treec8bce73ed0fd23ca40ddbe54cbc1486527f370e0 /fs/adfs/super.c
parenta464152f2e6dfd6d8be45c5e591cb8be20a97bdb (diff)
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 <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs/super.c')
-rw-r--r--fs/adfs/super.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index b2455e9ab923..9c93122925cf 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -231,6 +231,12 @@ static void adfs_free_inode(struct inode *inode)
kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
}
+static int adfs_drop_inode(struct inode *inode)
+{
+ /* always drop inodes if we are read-only */
+ return !IS_ENABLED(CONFIG_ADFS_FS_RW) || IS_RDONLY(inode);
+}
+
static void init_once(void *foo)
{
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
@@ -263,7 +269,7 @@ static void destroy_inodecache(void)
static const struct super_operations adfs_sops = {
.alloc_inode = adfs_alloc_inode,
.free_inode = adfs_free_inode,
- .drop_inode = generic_delete_inode,
+ .drop_inode = adfs_drop_inode,
.write_inode = adfs_write_inode,
.put_super = adfs_put_super,
.statfs = adfs_statfs,