mirror of
https://github.com/psankar/simplefs.git
synced 2025-07-21 21:14:30 +02:00
fix another inode leaking in simplefs_create_fs_object()
There we iterate over inodes using simplefs_get_inode(), while instead we already have last inode number, just use it instead, and increment some paddings to it (start inode, reserved inodes). And form after this patch kedr shows that there is no leaks. (but we must recheck it in the future.)
This commit is contained in:
parent
98bbe99632
commit
031f974c36
8
simple.c
8
simple.c
@ -488,13 +488,7 @@ static int simplefs_create_fs_object(struct inode *dir, struct dentry *dentry,
|
||||
inode->i_sb = sb;
|
||||
inode->i_op = &simplefs_inode_ops;
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_ino = SIMPLEFS_START_INO;
|
||||
|
||||
/* Loop until we get an unique inode number */
|
||||
while (simplefs_get_inode(sb, inode->i_ino)) {
|
||||
/* inode inode->i_ino already exists */
|
||||
inode->i_ino++;
|
||||
}
|
||||
inode->i_ino = (count + SIMPLEFS_START_INO - SIMPLEFS_RESERVED_INODES + 1);
|
||||
|
||||
sfs_inode = kmalloc(sizeof(struct simplefs_inode), GFP_KERNEL);
|
||||
sfs_inode->inode_no = inode->i_ino;
|
||||
|
5
simple.h
5
simple.h
@ -4,6 +4,11 @@
|
||||
#define SIMPLEFS_DEFAULT_BLOCK_SIZE 4096
|
||||
#define SIMPLEFS_FILENAME_MAXLEN 255
|
||||
#define SIMPLEFS_START_INO 10
|
||||
/**
|
||||
* Reserver inodes for super block, inodestore
|
||||
* and datablock
|
||||
*/
|
||||
#define SIMPLEFS_RESERVED_INODES 3
|
||||
|
||||
#ifdef SIMPLEFS_DEBUG
|
||||
#define sfs_trace(fmt, ...) { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user