Hi, I am writing a small filesystem module in which currently I am trying to implement "touch". I am able to allocate a new inode and fill the proper information and mark the inode as dirty so that it can be written back to disk. However before write_inode is called, destroy_inode is getting called for the same inode number and hence it is not getting reflected on disk. The stack trace looks like below. I am not able to understand from where sys_close is getting called or what might be causing this function to get called. (gdb) bt #0 destroy_inode (inode=0x273d3c00) at fs/inode.c:172 #1 0x080b6551 in generic_forget_inode (inode=0x273d3c00) at fs/inode.c:1080 #2 0x080b6575 in generic_drop_inode (inode=0x9006ab8) at fs/inode.c:1093 #3 0x080b65fd in iput (inode=0x273d3c00) at fs/inode.c:1116 #4 0x080b3cc5 in dentry_iput (dentry=0x26281c70) at fs/dcache.c:116 #5 0x080b3cfd in d_kill (dentry=0x26281c70) at fs/dcache.c:139 #6 0x080b3de9 in dput (dentry=0x26281c70) at fs/dcache.c:221 #7 0x080a6a29 in __fput (file=0x83625a0) at fs/file_table.c:181 #8 0x080a6918 in fput (file=0x273d3d14) at fs/file_table.c:144 #9 0x080a556a in filp_close (filp=0x83625a0, id=0x82a17d8) at fs/open.c:1106 #10 0x080a55d6 in sys_close (fd=0) at fs/open.c:1135 #11 0x0805939a in handle_syscall (r=0x82508f4) at arch/um/kernel/skas/syscall.c:38 #12 0x0806584a in handle_trap (pid=15670, regs=0x82508f4, local_using_sysemu=2) at arch/um/os-Linux/skas/process.c:173 #13 0x08065c41 in userspace (regs=0x82508f4) at arch/um/os-Linux/skas/process.c:330 #14 0x08059145 in fork_handler () at arch/um/kernel/skas/process.c:96 #15 0x1f38a045 in ?? () Below is my create function. I am using all this in UML environment. #define NNGFS_I(ptr) container_of(ptr,struct nngfs_inode_info,vino) int nngfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) { int inum=0,ret=0; struct buffer_head *bh; struct inode *newnip; struct nngfs_inode *nino; struct super_block *sb = dir->i_sb; struct nngfs_info *nsb = (struct nngfs_info *)(sb->s_fs_info); struct nngfs_superblock *n_sb = nsb->ngfs_sb; //See if the entry already exists in the dir ret = nngfs_find_entry(dir,dentry->d_name.name); if(ret!=-1){ return ERR_PTR(-EEXIST); } //See the bitmap and get the inode number inum = Get_free_inode_number(n_sb); if(inum == -1){ return ERR_PTR(-ENOSPC); } //Allocate the new inode newnip = new_inode(sb); if(!newnip){ return ERR_PTR(-ENOSPC); } bh = (struct buffer_head *)(nsb->sbh); n_sb->inode_bitmap=setbit(n_sb->inode_bitmap,inum); newnip->i_ino = inum; dir->i_nlink++; newnip->i_atime = newnip->i_mtime = newnip->i_ctime = CURRENT_TIME_SEC; newnip->i_uid = dir->i_uid; newnip->i_gid = dir->i_gid; if(S_ISDIR(mode)){ newnip->i_mode = NNGFS_DIR; newnip->i_op = &nngfs_dir_inode_operations; newnip->i_fop = &nngfs_dir_operations; } else{ newnip->i_mode = NNGFS_FILE; newnip->i_op = &nngfs_file_inode_operations; newnip->i_fop = &nngfs_file_operations; } nino = NNGFS_I(newnip); nino->filetype = newnip->i_mode ; nino->atime = nino->mtime = nino->ctime = CURRENT_TIME_SEC; nino->uid = dir->i_uid; nino->gid = dir->i_gid; nino->size = 0; nino->blockno = nino->inode+1; nino->magic = 0xdeadbeef; nino->inode = inum; sb->s_dirt=1; inode_inc_link_count(newnip); // insert_inode_hash(newnip); d_instantiate(dentry,newnip); mark_buffer_dirty(bh); //Write the new bitmap to disk mark_inode_dirty(newnip); //Add the name information to dir entry if(nngfs_dir_add(dir,inum,dentry->d_name.name)){ return ERR_PTR(-EMFILE); } mark_inode_dirty(dir); return 0; } Thanks for any help/suggestions. -- Thanks & Regards, ******************************************** Manish Katiyar ( http://mkatiyar.googlepages.com ) 3rd Floor, Fair Winds Block EGL Software Park Off Intermediate Ring Road Bangalore 560071, India *********************************************** -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ