[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Oops in JFFS




This code in jffs_rename() looks strange to me. Why are we passing
new_dentry to jffs_remove() when we want the _old_ file with the same name 
to be removed? I think we need to do a lookup to get the dentry for the old 
file with that name, don't we?



--        /* See if there already exists a file with the same name as
           new_name.  */
        if ((del_f = jffs_find_child(new_dir_f, new_dentry->d_name.name,
                                     new_dentry->d_name.len))) {
                raw_inode.rename = 1;
                raw_inode.dsize = sizeof(__u32);
                rename_data = del_f->ino;
        }

        /* Write the new node to the flash memory.  */
        if ((result = jffs_write_node(c, node, &raw_inode,
                                      new_dentry->d_name.name,
                                      (unsigned char*)&rename_data, 0, f)) < 0) {
                D(printk("jffs_rename(): Failed to write node to flash.\n"));
                kfree(node);
                DJM(no_jffs_node--);
                goto jffs_rename_end;
        }
        raw_inode.dsize = 0;

        if (raw_inode.rename) {
                /* The file with the same name must be deleted.  */
                //FIXME deadlock                down(&c->fmc->gclock);
                if ((result = jffs_remove(new_dir, new_dentry,
                                          del_f->mode)) < 0) {
                        /* This is really bad.  */
                        printk(KERN_ERR "JFFS: An error occurred in "
                               "rename().\n");
                }
                //              up(&c->fmc->gclock);
        }


dwmw2



To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com