diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index eb532e0..56de77f 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1320,18 +1322,27 @@ static int mount_ubifs(struct ubifs_info *c) if (err) goto out_orphans; err = ubifs_rcvry_gc_commit(c); - } else { - err = take_gc_lnum(c); if (err) goto out_orphans; + } else { + if (c->gc_lnum == -1) { + err = ubifs_rcvry_gc_commit(c); + if (err) + goto out_orphans; + } + else { + err = take_gc_lnum(c); + if (err) + goto out_orphans; - /* - * GC LEB may contain garbage if there was an unclean - * reboot, and it should be un-mapped. - */ - err = ubifs_leb_unmap(c, c->gc_lnum); - if (err) - return err; + /* + * GC LEB may contain garbage if there was an unclean + * reboot, and it should be un-mapped. + */ + err = ubifs_leb_unmap(c, c->gc_lnum); + if (err) + return err; + } } err = dbg_check_lprops(c); diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c index 28beaee..8d5b080 100644 --- a/fs/ubifs/master.c +++ b/fs/ubifs/master.c @@ -135,7 +135,7 @@ static int validate_master(const struct ubifs_info *c) goto out; } - if (c->gc_lnum >= c->leb_cnt || c->gc_lnum < c->main_first) { + if (c->gc_lnum != -1 && (c->gc_lnum >= c->leb_cnt || c->gc_lnum < c->main_first)) { err = 7; goto out; }