Re: UBIFS file-system corruption (missing inode) after power-cut on 4.14.96

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 4, 2019 at 11:53 PM Richard Weinberger
<richard@xxxxxxxxxxxxx> wrote:
> Can you please run your tests again with this patch applied?
> It needs further optimization, but we are on the right track.
>
> diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
> index 2f1618f300fb..c15e484f73a4 100644
> --- a/fs/ubifs/orphan.c
> +++ b/fs/ubifs/orphan.c
> @@ -691,8 +691,21 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
>                 n = (le32_to_cpu(orph->ch.len) - UBIFS_ORPH_NODE_SZ) >> 3;
>                 for (i = 0; i < n; i++) {
>                         union ubifs_key key1, key2;
> +                       struct ubifs_ino_node *ino;
> +
> +                       ino = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS);
> +                       if (!ino)
> +                               return -ENOMEM;
>
>                         inum = le64_to_cpu(orph->inos[i]);
> +                       ino_key_init(c, &key1, inum);
> +                       err = ubifs_tnc_lookup(c, &key1, ino);
> +                       if (!err && ino->nlink) {
> +                               kfree(ino);
> +                               continue;
> +                       }
> +                       kfree(ino);
> +
>                         dbg_rcvry("deleting orphaned inode %lu",
>                                   (unsigned long)inum);
>

Thanks Richard. The power-cut test is OK now with this change. I run
it with chk_fs=1 and it passes every time.

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



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux