Replace the odd handling of f_list.next = NULL with list_emptiness. fs/file_table.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff -puN fs/file_table.c~file_list_cleanup fs/file_table.c --- 25/fs/file_table.c~file_list_cleanup 2003-03-09 23:17:06.000000000 -0800 +++ 25-akpm/fs/file_table.c 2003-03-09 23:17:06.000000000 -0800 @@ -74,7 +74,7 @@ static int old_max = 0; struct file * f; if (likely(files_stat.nr_files < files_stat.max_files)) { - f = kmem_cache_alloc(filp_cachep, SLAB_KERNEL); + f = kmem_cache_alloc(filp_cachep, GFP_KERNEL); if (f) { got_one: memset(f, 0, sizeof(*f)); @@ -90,7 +90,8 @@ got_one: f->f_uid = current->fsuid; f->f_gid = current->fsgid; f->f_owner.lock = RW_LOCK_UNLOCKED; - /* f->f_version, f->f_list.next: 0 */ + /* f->f_version: 0 */ + INIT_LIST_HEAD(&f->f_list); return f; } } @@ -130,7 +131,7 @@ int init_private_file(struct file *filp, filp->f_uid = current->fsuid; filp->f_gid = current->fsgid; filp->f_op = dentry->d_inode->i_fop; - filp->f_list.next = NULL; + INIT_LIST_HEAD(&filp->f_list); if (filp->f_op->open) return filp->f_op->open(dentry->d_inode, filp); else @@ -168,8 +169,7 @@ void __fput(struct file * file) file_list_lock(); file->f_dentry = NULL; file->f_vfsmnt = NULL; - if (file->f_list.next) - list_del(&file->f_list); + list_del(&file->f_list); file_free(file); file_list_unlock(); dput(dentry); @@ -196,8 +196,7 @@ void put_filp(struct file *file) if(atomic_dec_and_test(&file->f_count)) { security_file_free(file); file_list_lock(); - if (file->f_list.next) - list_del(&file->f_list); + list_del(&file->f_list); file_free(file); file_list_unlock(); } @@ -208,18 +207,14 @@ void file_move(struct file *file, struct if (!list) return; file_list_lock(); - if (file->f_list.next) - list_del(&file->f_list); - list_add(&file->f_list, list); + list_move(&file->f_list, list); file_list_unlock(); } void file_kill(struct file *file) { file_list_lock(); - if (file->f_list.next) - list_del(&file->f_list); - file->f_list.next = NULL; + list_del_init(&file->f_list); file_list_unlock(); } _