public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: liu.song11@zte.com.cn
Cc: wang.bo116@zte.com.cn, cui.yunfeng@zte.com.cn,
	linux-mtd@lists.infradead.org, jiang.xuexin@zte.com.cn,
	deng.chao1@zte.com.cn
Subject: Re: [PATCH]jffs2:bugfix for should not appeared directory hard link
Date: Thu, 12 Feb 2015 13:43:19 +0000	[thread overview]
Message-ID: <1423748599.15180.10.camel@infradead.org> (raw)
In-Reply-To: <OFA26F19B7.DF3A70A5-ON48257D7B.00265361-48257D7B.0033C198@zte.com.cn>

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

On Fri, 2014-10-24 at 17:26 +0800, liu.song11@zte.com.cn wrote:
> 
> When jffs2 with summary, during the mounting period, in 
> jffs2_build_remove_unlinked_inode will handle unlinke inode, but this
> will cause unlinked directory's deletion  dirent erased before
> it's obsoleted dirent.So if the directory has renamed, then could
> cause a hard link when we remount jffs2.

> We can stable reproduce the hard link only by following process.
> 1. we mount jffs2 in /mnt
> 2. create directories /mnt/SW1/, /mnt/SW2/
> 3. create directory /mnt/old/
> 4. rename /mnt/SW1/ to /mnt/old/SW1/, /mnt/SW2/ to /mnt/old/SW2/
> 5. do some data write. don't touch these directories.
> 6. rename /mnt/old/SW1/ to /mnt/SW1/, /mnt/old/SW2/ to /mnt/SW2/
> 7. delete /mnt/old/
> 
> do above process 3 - 7 several times, then reboot, during the mounting
> process, we could found
> /mnt/SW1/ and /mnt/old/SW1/ become hard link,/mnt/SW2/
> and /mnt/old/SW2/ become hard link. So we
> do some job to fix this bug.We have tested this patch and the hard
> link error will never occur.

Hi, apologies for the delay in looking at this.

I'm trying to understand the root cause of the problem. It looks like
the real problem here is that the /mnt/old/ directory seems to exist,
when it shouldn't?

It shouldn't *matter* that we erased the deletion dirents from /mnt/old/
leaving potentially *valid* dirents pointing to the "SW1" and "SW2"
inodes, should it? Because the /mnt/ directory *itself* shouldn't exist.

As far as I can tell, your patch seems to focus on the dirents pointing
to the SW1 and SW2 directories. But I think that's the wrong approach.

On mounting the file system again after /mnt/old was supposed to have
been deleted, *why* is it still appearing? Can you capture debug
messages over a serial console with CONFIG_JFFS2_FS_DEBUG=2? 

I'd like to see the part in step #7 where it actually writes the
deletion dirent for /mnt/foo, followed by the full log of the remount
where it erroneously decides that /mnt/foo still exists.

Thanks.

-- 
dwmw2

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]

  parent reply	other threads:[~2015-02-12 13:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24  9:26 [PATCH]jffs2:bugfix for should not appeared directory hard link liu.song11
2014-11-05 11:45 ` Brian Norris
2014-11-11  7:12   ` liu.song11
2014-11-12  6:45   ` Liu Song
2014-12-17  1:53     ` Brian Norris
2014-12-17  2:02       ` nick
2015-02-12 13:43 ` David Woodhouse [this message]
2015-02-13  4:09   ` liu.song11
2015-02-13 10:13     ` David Woodhouse
2015-02-13 11:28       ` David Woodhouse
2015-03-12  3:05         ` liu.song11
     [not found] <OF2CCB8417.29770A56-ON48257EE5.0004DBEE-48257EE5.0004E5CC@LocalDomain>
2015-10-26  3:19 ` deng.chao1
2016-02-01 14:21   ` 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=1423748599.15180.10.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=cui.yunfeng@zte.com.cn \
    --cc=deng.chao1@zte.com.cn \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=linux-mtd@lists.infradead.org \
    --cc=liu.song11@zte.com.cn \
    --cc=wang.bo116@zte.com.cn \
    /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