public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Simon Munton <Simon.Munton@m4data.co.uk>
Cc: mtd@infradead.org, "JFFS (E-mail)" <jffs-dev@axis.com>
Subject: Re: Oops in JFFS
Date: Tue, 28 Nov 2000 16:56:04 +0000	[thread overview]
Message-ID: <3375.975430564@redhat.com> (raw)
In-Reply-To: <00B4D286538DD311BC6E005004E9EFC73B0F6C@M4EXCH>


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, send "unsubscribe mtd" to majordomo@infradead.org

  parent reply	other threads:[~2000-11-28 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-28 16:24 Oops in JFFS Simon Munton
2000-11-28 16:45 ` David Woodhouse
2000-11-28 16:49 ` David Woodhouse
2000-11-28 16:56 ` David Woodhouse [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-28 16:53 Simon Munton
2000-11-27 12:02 Simon Munton
2000-11-28 15:35 ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3375.975430564@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=Simon.Munton@m4data.co.uk \
    --cc=jffs-dev@axis.com \
    --cc=mtd@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox