linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
@ 2020-01-19 21:52 Richard Weinberger
  2020-04-29 14:56 ` John Ogness
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2020-01-19 21:52 UTC (permalink / raw)
  To: linux-mtd; +Cc: linux-kernel, Richard Weinberger

Orphans are allowed to point to deleted inodes.
So -ENOENT is not a fatal error.

Reported-by: Кочетков Максим <fido_max@inbox.ru>
Reported-and-tested-by: "Christian Berger" <Christian.Berger@de.bosch.com>
Fixes: ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.")
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/orphan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
index 54d6db61106f..2645917360b9 100644
--- a/fs/ubifs/orphan.c
+++ b/fs/ubifs/orphan.c
@@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
 
 			ino_key_init(c, &key1, inum);
 			err = ubifs_tnc_lookup(c, &key1, ino);
-			if (err)
+			if (err && err != -ENOENT)
 				goto out_free;
 
 			/*
 			 * Check whether an inode can really get deleted.
 			 * linkat() with O_TMPFILE allows rebirth of an inode.
 			 */
-			if (ino->nlink == 0) {
+			if (err == 0 && ino->nlink == 0) {
 				dbg_rcvry("deleting orphaned inode %lu",
 					  (unsigned long)inum);
 
-- 
2.16.4


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

* Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
  2020-01-19 21:52 [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() Richard Weinberger
@ 2020-04-29 14:56 ` John Ogness
  2020-04-29 15:03   ` Richard Weinberger
  2020-04-29 18:51   ` Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()) Richard Weinberger
  0 siblings, 2 replies; 6+ messages in thread
From: John Ogness @ 2020-04-29 14:56 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, linux-kernel

Hi Richard,

Could you CC this patch to stable? It fixes a serious problem that I am
seeing on real devices (i.e. Linux not being able to mount its root
filesystem after a power cut). Thanks.

John Ogness

On 2020-01-19, Richard Weinberger <richard@nod.at> wrote:
> Orphans are allowed to point to deleted inodes.
> So -ENOENT is not a fatal error.
>
> Reported-by: Кочетков Максим <fido_max@inbox.ru>
> Reported-and-tested-by: "Christian Berger" <Christian.Berger@de.bosch.com>
> Fixes: ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.")
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  fs/ubifs/orphan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
> index 54d6db61106f..2645917360b9 100644
> --- a/fs/ubifs/orphan.c
> +++ b/fs/ubifs/orphan.c
> @@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
>  
>  			ino_key_init(c, &key1, inum);
>  			err = ubifs_tnc_lookup(c, &key1, ino);
> -			if (err)
> +			if (err && err != -ENOENT)
>  				goto out_free;
>  
>  			/*
>  			 * Check whether an inode can really get deleted.
>  			 * linkat() with O_TMPFILE allows rebirth of an inode.
>  			 */
> -			if (ino->nlink == 0) {
> +			if (err == 0 && ino->nlink == 0) {
>  				dbg_rcvry("deleting orphaned inode %lu",
>  					  (unsigned long)inum);

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

* Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
  2020-04-29 14:56 ` John Ogness
@ 2020-04-29 15:03   ` Richard Weinberger
  2020-04-29 18:51   ` Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()) Richard Weinberger
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Weinberger @ 2020-04-29 15:03 UTC (permalink / raw)
  To: John Ogness; +Cc: linux-mtd, linux-kernel

Hello John,

----- Ursprüngliche Mail -----
> Von: "John Ogness" <john.ogness@linutronix.de>
> An: "richard" <richard@nod.at>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>
> Gesendet: Mittwoch, 29. April 2020 16:56:31
> Betreff: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()

> Hi Richard,
> 
> Could you CC this patch to stable? It fixes a serious problem that I am
> seeing on real devices (i.e. Linux not being able to mount its root
> filesystem after a power cut). Thanks.

It has a Fixes-Tag, so it should make it into stable.

Thanks,
//richard

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

* Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans())
  2020-04-29 14:56 ` John Ogness
  2020-04-29 15:03   ` Richard Weinberger
@ 2020-04-29 18:51   ` Richard Weinberger
  2020-04-30  7:11     ` Greg KH
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2020-04-29 18:51 UTC (permalink / raw)
  To: stable; +Cc: linux-mtd, linux-kernel, John Ogness

----- Ursprüngliche Mail -----
> Von: "John Ogness" <john.ogness@linutronix.de>
> An: "richard" <richard@nod.at>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>
> Gesendet: Mittwoch, 29. April 2020 16:56:31
> Betreff: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()

> Hi Richard,
> 
> Could you CC this patch to stable? It fixes a serious problem that I am
> seeing on real devices (i.e. Linux not being able to mount its root
> filesystem after a power cut). Thanks.

Just checked again, better ask stable maintainers. :-)

Stable maintainers, can you please make sure this patch will make it
into stable?
The upstream commit is:
4ab25ac8b2b5 ("ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()")

I always thought havings a Fixes-Tag is enough to make sure it will
get picked up. Isn't this the case?

Thanks,
//richard
 
> John Ogness
> 
> On 2020-01-19, Richard Weinberger <richard@nod.at> wrote:
>> Orphans are allowed to point to deleted inodes.
>> So -ENOENT is not a fatal error.
>>
>> Reported-by: Кочетков Максим <fido_max@inbox.ru>
>> Reported-and-tested-by: "Christian Berger" <Christian.Berger@de.bosch.com>
>> Fixes: ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.")
>> Signed-off-by: Richard Weinberger <richard@nod.at>
>> ---
>>  fs/ubifs/orphan.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
>> index 54d6db61106f..2645917360b9 100644
>> --- a/fs/ubifs/orphan.c
>> +++ b/fs/ubifs/orphan.c
>> @@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct
>> ubifs_scan_leb *sleb,
>>  
>>  			ino_key_init(c, &key1, inum);
>>  			err = ubifs_tnc_lookup(c, &key1, ino);
>> -			if (err)
>> +			if (err && err != -ENOENT)
>>  				goto out_free;
>>  
>>  			/*
>>  			 * Check whether an inode can really get deleted.
>>  			 * linkat() with O_TMPFILE allows rebirth of an inode.
>>  			 */
>> -			if (ino->nlink == 0) {
>> +			if (err == 0 && ino->nlink == 0) {
>>  				dbg_rcvry("deleting orphaned inode %lu",
> >  					  (unsigned long)inum);

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

* Re: Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans())
  2020-04-29 18:51   ` Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()) Richard Weinberger
@ 2020-04-30  7:11     ` Greg KH
  2020-04-30  7:41       ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2020-04-30  7:11 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: stable, linux-mtd, linux-kernel, John Ogness

On Wed, Apr 29, 2020 at 08:51:06PM +0200, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "John Ogness" <john.ogness@linutronix.de>
> > An: "richard" <richard@nod.at>
> > CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>
> > Gesendet: Mittwoch, 29. April 2020 16:56:31
> > Betreff: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
> 
> > Hi Richard,
> > 
> > Could you CC this patch to stable? It fixes a serious problem that I am
> > seeing on real devices (i.e. Linux not being able to mount its root
> > filesystem after a power cut). Thanks.
> 
> Just checked again, better ask stable maintainers. :-)
> 
> Stable maintainers, can you please make sure this patch will make it
> into stable?
> The upstream commit is:
> 4ab25ac8b2b5 ("ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()")
> 
> I always thought havings a Fixes-Tag is enough to make sure it will
> get picked up. Isn't this the case?

No it is not, please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

Our scripts are doing better to dig out stuff where maintainers mess up
and forget to put the cc: stable tag, but you can never rely on it.
Please stick with the above rules that have been there for 15+ years :)

thanks,

greg k-h

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

* Re: Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans())
  2020-04-30  7:11     ` Greg KH
@ 2020-04-30  7:41       ` Richard Weinberger
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Weinberger @ 2020-04-30  7:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: stable, linux-mtd, linux-kernel, John Ogness

----- Ursprüngliche Mail -----
>> I always thought havings a Fixes-Tag is enough to make sure it will
>> get picked up. Isn't this the case?
> 
> No it is not, please read:
>    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly.
> 
> Our scripts are doing better to dig out stuff where maintainers mess up
> and forget to put the cc: stable tag, but you can never rely on it.
> Please stick with the above rules that have been there for 15+ years :)

Sir, yes, sir.

Thanks,
//richard

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

end of thread, other threads:[~2020-04-30  7:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 21:52 [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() Richard Weinberger
2020-04-29 14:56 ` John Ogness
2020-04-29 15:03   ` Richard Weinberger
2020-04-29 18:51   ` Please queue ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans() for stable (was: Re: [PATCH] ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()) Richard Weinberger
2020-04-30  7:11     ` Greg KH
2020-04-30  7:41       ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).