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:
Azat Khuzhin 2013-09-30 02:21:03 +04:00
parent 98bbe99632
commit 031f974c36
2 changed files with 6 additions and 7 deletions

View File

@ -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;

View File

@ -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, ...) { \