summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c18
-rw-r--r--fs/squashfs/inode.c18
-rw-r--r--fs/squashfs/squashfs.c3
-rw-r--r--fs/squashfs/squashfs.h1
-rw-r--r--fs/squashfs/super.c1
5 files changed, 14 insertions, 27 deletions
diff --git a/fs/fs.c b/fs/fs.c
index e04cadfe5d..5784e9c1f3 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -667,19 +667,17 @@ static void fs_remove(struct device_d *dev)
if (fsdev->loop && fsdev->cdev)
cdev_remove_loop(fsdev->cdev);
- dput(sb->s_root);
+ if (fsdev->vfsmount.mountpoint)
+ fsdev->vfsmount.mountpoint->d_flags &= ~DCACHE_MOUNTED;
+
dentry_delete_subtree(sb, sb->s_root);
list_for_each_entry_safe(inode, tmp, &sb->s_inodes, i_sb_list)
destroy_inode(inode);
- if (fsdev->vfsmount.mountpoint)
- fsdev->vfsmount.mountpoint->d_flags &= ~DCACHE_MOUNTED;
-
mntput(fsdev->vfsmount.parent);
free(fsdev->backingstore);
- free(fsdev);
}
struct bus_type fs_bus = {
@@ -759,10 +757,18 @@ static void init_super(struct super_block *sb)
static int fsdev_umount(struct fs_device_d *fsdev)
{
+ int ret;
+
if (fsdev->vfsmount.ref)
return -EBUSY;
- return unregister_device(&fsdev->dev);
+ ret = unregister_device(&fsdev->dev);
+ if (ret)
+ return ret;
+
+ free(fsdev);
+
+ return 0;
}
/**
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index 470536e589..64155d47db 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -44,22 +44,6 @@
#include "squashfs_fs_i.h"
#include "squashfs.h"
-struct inode *iget_locked_squashfs(struct super_block *sb, unsigned long ino)
-{
- struct inode *inode;
- struct squashfs_inode_info *ei;
-
- ei = malloc(sizeof(struct squashfs_inode_info));
- inode = &ei->vfs_inode;
- if (inode) {
- inode->i_ino = ino;
- inode->i_sb = sb;
- inode->i_state = I_SYNC | I_NEW;
- }
-
- return inode;
-}
-
/*
* Initialise VFS inode with the base inode information common to all
* Squashfs inode types. Sqsh_ino contains the unswapped base inode
@@ -94,7 +78,7 @@ static int squashfs_new_inode(struct super_block *sb, struct inode *inode,
struct inode *squashfs_iget(struct super_block *sb, long long ino,
unsigned int ino_number)
{
- struct inode *inode = iget_locked_squashfs(sb, ino_number);
+ struct inode *inode = iget_locked(sb, ino_number);
int err;
TRACE("Entered squashfs_iget\n");
diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index 69451f7b84..be03618b2f 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -101,6 +101,7 @@ static int squashfs_probe(struct device_d *dev)
if (ret)
goto err_out;
+ sb->s_op = &squashfs_super_ops;
ret = squashfs_mount(fsdev, 0);
if (ret) {
@@ -110,8 +111,6 @@ static int squashfs_probe(struct device_d *dev)
squashfs_set_rootarg(fsdev);
- sb->s_op = &squashfs_super_ops;
-
return 0;
err_out:
diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
index 31c9bc454e..825df2aedd 100644
--- a/fs/squashfs/squashfs.h
+++ b/fs/squashfs/squashfs.h
@@ -52,7 +52,6 @@ static inline struct squashfs_page *squashfs_page(struct page *page)
#define WARNING(s, args...) pr_warn("SQUASHFS: "s, ## args)
-struct inode *iget_locked_squashfs(struct super_block *sb, unsigned long ino);
char *squashfs_devread(struct squashfs_sb_info *fs, int byte_offset,
int byte_len);
extern int squashfs_mount(struct fs_device_d *fsdev,
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index e2b7b8d5a1..35df3a0307 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -83,7 +83,6 @@ void squashfs_put_super(struct super_block *sb)
}
if (sb->s_root) {
- kfree(squashfs_i(sb->s_root->d_inode));
kfree(sb->s_root);
sb->s_root = NULL;
}