ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
Richard Weinberger
maintainerPATCH 1/1 ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
Orphans are allowed to point to deleted inodes.
So -ENOENT is not a fatal error.
--- fs/ubifs/orphan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ubifs/orphan.c +2 -2
@@ -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);
Signature · 6 lines
2.16.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
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
Quoted 31 lines · Richard Weinberger
Orphans are allowed to point to deleted inodes.
So-ENOENTis not a fatal error.Reported-by Кочетков Максим <[email protected]>Reported-and-tested-by "Christian Berger" <[email protected]>Fixes ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.")Signed-off-by Richard Weinberger <[email protected]>--- fs/ubifs/orphan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ubifs/orphan.c +2
-2@@ -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);
Richard Weinberger
maintainerHello John,
----- Ursprüngliche Mail -----
Quoted 11 lines
Von: "John Ogness" <[email protected]>
An: "richard" <[email protected]>
CC: "linux-mtd" <[email protected]>, "linux-kernel" <[email protected]>
Gesendet: Mittwoch, 29. April 2020 16:56:31
Betreff: Re: [PATCH] ubifs: Fixubifs_tnc_lookup()usage indo_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
Richard Weinberger
maintainerPlease 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())
In reply to John Ogness----- Ursprüngliche Mail -----
Quoted 11 lines
Von: "John Ogness" <[email protected]>
An: "richard" <[email protected]>
CC: "linux-mtd" <[email protected]>, "linux-kernel" <[email protected]>
Gesendet: Mittwoch, 29. April 2020 16:56:31
Betreff: Re: [PATCH] ubifs: Fixubifs_tnc_lookup()usage indo_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
Quoted 35 lines
John Ogness
Quoted 32 lines · Richard Weinberger
Orphans are allowed to point to deleted inodes.
So-ENOENTis not a fatal error.Reported-by Кочетков Максим <[email protected]>Reported-and-tested-by "Christian Berger" <[email protected]>Fixes ee1438ce5dc4 ("ubifs: Check link count of inodes when killing orphans.")Signed-off-by Richard Weinberger <[email protected]>--- fs/ubifs/orphan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ubifs/orphan.c +2
-2@@ -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);
Greg KH
maintainerRe: 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())
Quoted 15 lines · Richard Weinberger
----- Ursprüngliche Mail -----
Quoted 11 lines
Von: "John Ogness" <[email protected]>
An: "richard" <[email protected]>
CC: "linux-mtd" <[email protected]>, "linux-kernel" <[email protected]>
Gesendet: Mittwoch, 29. April 2020 16:56:31
Betreff: Re: [PATCH] ubifs: Fixubifs_tnc_lookup()usage indo_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. :-)
Quoted 7 lines
Stable maintainers, can you please make sure this patch will make it into stable?
The upstream commit is:4ab25ac8b2b5("ubifs: Fixubifs_tnc_lookup()usage indo_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
Richard Weinberger
maintainerRe: 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())
----- Ursprüngliche Mail -----
Quoted 10 lines
Quoted 2 lines
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