All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch v1 0/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52 ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

This patch make sure one file could be deleted completely when write and delete mixed
operations occur power-cut.

Guochun Mao (1):
  ubifs: only check replay with inode type to judge if inode linked

 fs/ubifs/replay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.18.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v1 0/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52 ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

This patch make sure one file could be deleted completely when write and delete mixed
operations occur power-cut.

Guochun Mao (1):
  ubifs: only check replay with inode type to judge if inode linked

 fs/ubifs/replay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.18.0

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v1 0/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52 ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

This patch make sure one file could be deleted completely when write and delete mixed
operations occur power-cut.

Guochun Mao (1):
  ubifs: only check replay with inode type to judge if inode linked

 fs/ubifs/replay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.18.0

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch v1 0/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52 ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

This patch make sure one file could be deleted completely when write and delete mixed
operations occur power-cut.

Guochun Mao (1):
  ubifs: only check replay with inode type to judge if inode linked

 fs/ubifs/replay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.18.0

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
  2021-03-16  8:52 ` guochun.mao
  (?)
  (?)
@ 2021-03-16  8:52   ` guochun.mao
  -1 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream, Guochun Mao

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)
 			return r->deletion == 0;
 
 	}
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52   ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream, Guochun Mao

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)
 			return r->deletion == 0;
 
 	}
-- 
2.18.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52   ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream, Guochun Mao

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)
 			return r->deletion == 0;
 
 	}
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-03-16  8:52   ` guochun.mao
  0 siblings, 0 replies; 16+ messages in thread
From: guochun.mao @ 2021-03-16  8:52 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream, Guochun Mao

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)
 			return r->deletion == 0;
 
 	}
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
  2021-03-16  8:52   ` guochun.mao
  (?)
  (?)
@ 2021-04-07  3:23     ` Guochun Mao
  -1 siblings, 0 replies; 16+ messages in thread
From: Guochun Mao @ 2021-04-07  3:23 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

Hi Richard,

Gentle ping.


On Tue, 2021-03-16 at 16:52 +0800, 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)
>  			return r->deletion == 0;
>  
>  	}


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-04-07  3:23     ` Guochun Mao
  0 siblings, 0 replies; 16+ messages in thread
From: Guochun Mao @ 2021-04-07  3:23 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

Hi Richard,

Gentle ping.


On Tue, 2021-03-16 at 16:52 +0800, 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)
>  			return r->deletion == 0;
>  
>  	}

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-04-07  3:23     ` Guochun Mao
  0 siblings, 0 replies; 16+ messages in thread
From: Guochun Mao @ 2021-04-07  3:23 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

Hi Richard,

Gentle ping.


On Tue, 2021-03-16 at 16:52 +0800, 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)
>  			return r->deletion == 0;
>  
>  	}

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-04-07  3:23     ` Guochun Mao
  0 siblings, 0 replies; 16+ messages in thread
From: Guochun Mao @ 2021-04-07  3:23 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Matthias Brugger, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek, srv_heupstream

Hi Richard,

Gentle ping.


On Tue, 2021-03-16 at 16:52 +0800, 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)
>  			return r->deletion == 0;
>  
>  	}

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
  2021-03-16  8:52   ` guochun.mao
  (?)
  (?)
@ 2021-04-07 21:56     ` Richard Weinberger
  -1 siblings, 0 replies; 16+ messages in thread
From: Richard Weinberger @ 2021-04-07 21:56 UTC (permalink / raw)
  To: guochun.mao
  Cc: Richard Weinberger, Matthias Brugger, linux-mtd, LKML,
	linux-arm-kernel, linux-mediatek, srv_heupstream

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-04-07 21:56     ` Richard Weinberger
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Weinberger @ 2021-04-07 21:56 UTC (permalink / raw)
  To: guochun.mao
  Cc: Richard Weinberger, Matthias Brugger, linux-mtd, LKML,
	linux-arm-kernel, linux-mediatek, srv_heupstream

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/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-04-07 21:56     ` Richard Weinberger
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Weinberger @ 2021-04-07 21:56 UTC (permalink / raw)
  To: guochun.mao
  Cc: Richard Weinberger, Matthias Brugger, linux-mtd, LKML,
	linux-arm-kernel, linux-mediatek, srv_heupstream

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] ubifs: only check replay with inode type to judge if inode linked
@ 2021-04-07 21:56     ` Richard Weinberger
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Weinberger @ 2021-04-07 21:56 UTC (permalink / raw)
  To: guochun.mao
  Cc: Richard Weinberger, Matthias Brugger, linux-mtd, LKML,
	linux-arm-kernel, linux-mediatek, srv_heupstream

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-04-07 21:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-04-07 21:56     ` Richard Weinberger
2021-04-07 21:56     ` Richard Weinberger
2021-04-07 21:56     ` Richard Weinberger

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.