All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard.weinberger@gmail.com>
To: guochun.mao@mediatek.com
Cc: Richard Weinberger <richard@nod.at>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-mtd@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com
Subject: Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
Date: Wed, 7 Apr 2021 23:56:36 +0200	[thread overview]
Message-ID: <CAFLxGvygphmHbhzHJmSO=NQFO_02oSamXVjC5Loj2nCcQWWYNg@mail.gmail.com> (raw)
In-Reply-To: <20210316085214.25024-2-guochun.mao@mediatek.com>

On Tue, Mar 16, 2021 at 10:00 AM <guochun.mao@mediatek.com> wrote:
>
> From: Guochun Mao <guochun.mao@mediatek.com>
>
> Conside the following case, it just write a big file into flash,
> when complete writing, delete the file, and then power off promptly.
> Next time power on, we'll get a replay list like:
> ...
> LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80
> LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80
> LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
> ...
> In the replay list, data nodes' deletion are 0, and the inode node's
> deletion is 1. In current logic, the file's dentry will be removed,
> but inode and the flash space it occupied will be reserved.
> User will see that much free space been disappeared.
>
> We only need to check the deletion value of the following inode type
> node of the replay entry.
>
> Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
> ---
>  fs/ubifs/replay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
> index 0f8a6a16421b..1929ec63a0cb 100644
> --- a/fs/ubifs/replay.c
> +++ b/fs/ubifs/replay.c
> @@ -223,7 +223,8 @@ static bool inode_still_linked(struct ubifs_info *c, struct replay_entry *rino)
>          */
>         list_for_each_entry_reverse(r, &c->replay_list, list) {
>                 ubifs_assert(c, r->sqnum >= rino->sqnum);
> -               if (key_inum(c, &r->key) == key_inum(c, &rino->key))
> +               if (key_inum(c, &r->key) == key_inum(c, &rino->key) &&
> +                   key_type(c, &r->key) == UBIFS_INO_KEY)

This change makes sense. Thanks a lot for hunting this down.
It will be part of the merge window.

-- 
Thanks,
//richard

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard.weinberger@gmail.com>
To: guochun.mao@mediatek.com
Cc: Richard Weinberger <richard@nod.at>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	 linux-mtd@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,  srv_heupstream@mediatek.com
Subject: Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
Date: Wed, 7 Apr 2021 23:56:36 +0200	[thread overview]
Message-ID: <CAFLxGvygphmHbhzHJmSO=NQFO_02oSamXVjC5Loj2nCcQWWYNg@mail.gmail.com> (raw)
In-Reply-To: <20210316085214.25024-2-guochun.mao@mediatek.com>

On Tue, Mar 16, 2021 at 10:00 AM <guochun.mao@mediatek.com> wrote:
>
> From: Guochun Mao <guochun.mao@mediatek.com>
>
> Conside the following case, it just write a big file into flash,
> when complete writing, delete the file, and then power off promptly.
> Next time power on, we'll get a replay list like:
> ...
> LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80
> LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80
> LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
> ...
> In the replay list, data nodes' deletion are 0, and the inode node's
> deletion is 1. In current logic, the file's dentry will be removed,
> but inode and the flash space it occupied will be reserved.
> User will see that much free space been disappeared.
>
> We only need to check the deletion value of the following inode type
> node of the replay entry.
>
> Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
> ---
>  fs/ubifs/replay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
> index 0f8a6a16421b..1929ec63a0cb 100644
> --- a/fs/ubifs/replay.c
> +++ b/fs/ubifs/replay.c
> @@ -223,7 +223,8 @@ static bool inode_still_linked(struct ubifs_info *c, struct replay_entry *rino)
>          */
>         list_for_each_entry_reverse(r, &c->replay_list, list) {
>                 ubifs_assert(c, r->sqnum >= rino->sqnum);
> -               if (key_inum(c, &r->key) == key_inum(c, &rino->key))
> +               if (key_inum(c, &r->key) == key_inum(c, &rino->key) &&
> +                   key_type(c, &r->key) == UBIFS_INO_KEY)

This change makes sense. Thanks a lot for hunting this down.
It will be part of the merge window.

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard.weinberger@gmail.com>
To: guochun.mao@mediatek.com
Cc: Richard Weinberger <richard@nod.at>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	 linux-mtd@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,  srv_heupstream@mediatek.com
Subject: Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
Date: Wed, 7 Apr 2021 23:56:36 +0200	[thread overview]
Message-ID: <CAFLxGvygphmHbhzHJmSO=NQFO_02oSamXVjC5Loj2nCcQWWYNg@mail.gmail.com> (raw)
In-Reply-To: <20210316085214.25024-2-guochun.mao@mediatek.com>

On Tue, Mar 16, 2021 at 10:00 AM <guochun.mao@mediatek.com> wrote:
>
> From: Guochun Mao <guochun.mao@mediatek.com>
>
> Conside the following case, it just write a big file into flash,
> when complete writing, delete the file, and then power off promptly.
> Next time power on, we'll get a replay list like:
> ...
> LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80
> LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80
> LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
> ...
> In the replay list, data nodes' deletion are 0, and the inode node's
> deletion is 1. In current logic, the file's dentry will be removed,
> but inode and the flash space it occupied will be reserved.
> User will see that much free space been disappeared.
>
> We only need to check the deletion value of the following inode type
> node of the replay entry.
>
> Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
> ---
>  fs/ubifs/replay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
> index 0f8a6a16421b..1929ec63a0cb 100644
> --- a/fs/ubifs/replay.c
> +++ b/fs/ubifs/replay.c
> @@ -223,7 +223,8 @@ static bool inode_still_linked(struct ubifs_info *c, struct replay_entry *rino)
>          */
>         list_for_each_entry_reverse(r, &c->replay_list, list) {
>                 ubifs_assert(c, r->sqnum >= rino->sqnum);
> -               if (key_inum(c, &r->key) == key_inum(c, &rino->key))
> +               if (key_inum(c, &r->key) == key_inum(c, &rino->key) &&
> +                   key_type(c, &r->key) == UBIFS_INO_KEY)

This change makes sense. Thanks a lot for hunting this down.
It will be part of the merge window.

-- 
Thanks,
//richard

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard.weinberger@gmail.com>
To: guochun.mao@mediatek.com
Cc: Richard Weinberger <richard@nod.at>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	 linux-mtd@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,  srv_heupstream@mediatek.com
Subject: Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
Date: Wed, 7 Apr 2021 23:56:36 +0200	[thread overview]
Message-ID: <CAFLxGvygphmHbhzHJmSO=NQFO_02oSamXVjC5Loj2nCcQWWYNg@mail.gmail.com> (raw)
In-Reply-To: <20210316085214.25024-2-guochun.mao@mediatek.com>

On Tue, Mar 16, 2021 at 10:00 AM <guochun.mao@mediatek.com> wrote:
>
> From: Guochun Mao <guochun.mao@mediatek.com>
>
> Conside the following case, it just write a big file into flash,
> when complete writing, delete the file, and then power off promptly.
> Next time power on, we'll get a replay list like:
> ...
> LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80
> LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80
> LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
> ...
> In the replay list, data nodes' deletion are 0, and the inode node's
> deletion is 1. In current logic, the file's dentry will be removed,
> but inode and the flash space it occupied will be reserved.
> User will see that much free space been disappeared.
>
> We only need to check the deletion value of the following inode type
> node of the replay entry.
>
> Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
> ---
>  fs/ubifs/replay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
> index 0f8a6a16421b..1929ec63a0cb 100644
> --- a/fs/ubifs/replay.c
> +++ b/fs/ubifs/replay.c
> @@ -223,7 +223,8 @@ static bool inode_still_linked(struct ubifs_info *c, struct replay_entry *rino)
>          */
>         list_for_each_entry_reverse(r, &c->replay_list, list) {
>                 ubifs_assert(c, r->sqnum >= rino->sqnum);
> -               if (key_inum(c, &r->key) == key_inum(c, &rino->key))
> +               if (key_inum(c, &r->key) == key_inum(c, &rino->key) &&
> +                   key_type(c, &r->key) == UBIFS_INO_KEY)

This change makes sense. Thanks a lot for hunting this down.
It will be part of the merge window.

-- 
Thanks,
//richard

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-04-07 21:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16  8:52 [Patch v1 0/1] ubifs: only check replay with inode type to judge if inode linked guochun.mao
2021-03-16  8:52 ` guochun.mao
2021-03-16  8:52 ` guochun.mao
2021-03-16  8:52 ` guochun.mao
2021-03-16  8:52 ` [PATCH v1 1/1] " guochun.mao
2021-03-16  8:52   ` guochun.mao
2021-03-16  8:52   ` guochun.mao
2021-03-16  8:52   ` guochun.mao
2021-04-07  3:23   ` Guochun Mao
2021-04-07  3:23     ` Guochun Mao
2021-04-07  3:23     ` Guochun Mao
2021-04-07  3:23     ` Guochun Mao
2021-04-07 21:56   ` Richard Weinberger [this message]
2021-04-07 21:56     ` Richard Weinberger
2021-04-07 21:56     ` Richard Weinberger
2021-04-07 21:56     ` Richard Weinberger

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='CAFLxGvygphmHbhzHJmSO=NQFO_02oSamXVjC5Loj2nCcQWWYNg@mail.gmail.com' \
    --to=richard.weinberger@gmail.com \
    --cc=guochun.mao@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=richard@nod.at \
    --cc=srv_heupstream@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.