linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Philippe De Muyter <phdm@macq.eu>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: f2fs_bug_on in init_dirty_segmap
Date: Thu, 9 Mar 2017 15:11:46 -0800	[thread overview]
Message-ID: <20170309231146.GC4125@jaegeuk.local> (raw)
In-Reply-To: <20170309084227.GA11085@frolo.macqel>

On 03/09, Philippe De Muyter wrote:
> Hi,
> 
> thanks for your quick answer
> 
> On Wed, Mar 08, 2017 at 01:52:03PM -0800, Jaegeuk Kim wrote:
> > Hi,
> > 
> > On 03/08, Philippe De Muyter wrote:
> > > Hi f2fs developpers,
> > > 
> > > Please excuse my maybe dumb question.
> > > 
> > > I recently encountered a kernel panic at root mount time (thus making my
> > > system unusable, as my root partition is formatted as f2fs) due to the
> > > following segment in fs/f2fs/segment.c:init_dirty_segmap
> > > 
> > > 		if (valid_blocks > sbi->blocks_per_seg) {
> > >                         f2fs_bug_on(sbi, 1); <<<<<<<<<<<<<<<<<<<<
> > > 			continue;
> > > 		}
> > > 
> > > Is that really a condition requiring a kernel panic, or could a read-only
> > > mount be allowed ?
> > 
> > It would be helpful that you can remain your kernel and f2fs-tools version
> > information, as well as fsck.f2fs result.
> 
> It is actually a Freescale (now NXP) provided kernel tagged rel_imx_4.1.15_1.2.0_ga
> available at git://git.freescale.com/imx/linux-2.6-imx.git 
> 
> I surmise that the f2fs driver is the one from the linux-4.1 version.
> 
> > 
> > You can get the latest f2fs-tools from
> > http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git/log/?h=dev-test
> > 
> > Anyway, if you don't have time, you may have some options like:
> > 
> > 1. disable F2FS_CHECK_FS in Kconfig
> >  : bypass BUG_ON here, so mount-ro would be preferable.
> 
> Actually F2FS_CHECK_FS was disabled, but kernel panic'ed.

So, you got a warning message from there?

#ifdef CONFIG_F2FS_CHECK_FS
#define f2fs_bug_on(sbi, condition)	BUG_ON(condition)
#define f2fs_down_write(x, y)	down_write_nest_lock(x, y)
#else
#define f2fs_bug_on(sbi, condition)					\
	do {								\
		if (unlikely(condition)) {				\
			WARN_ON(1);					\
			set_sbi_flag(sbi, SBI_NEED_FSCK);		\
		}							\
	} while (0)
#define f2fs_down_write(x, y)	down_write(x)
#endif

> > 
> > 2. run fsck.f2fs
> >  : fix some inconsistency and let you mount your system again.
> > 
> > So, I think you'd better try #1 to retrieve your important data, and then
> > #2 to fix something wrong.
> 
> There wasn't a need to retrieve important data, as it is an unattended device
> in the wild.  The problem was that boot did not succeed anymore and the device
> needed a return to our aftersales department for reflashing.  Without the 'panic',
> and with a read-only mount we could probably fix it without reflashing
> and without return.

So, there is no fscking before mounting any filesystem during boot-up, right?
Most of distros and android do that and provide a recovery mode tho.

I think there is a way to mount with ro without loading in-memory structures
which results in potential panics. Will cosider about that. ;)

Note, there is a backported f2fs for v4.1 which I've been maintaining.

http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-stable.git/log/?h=linux-4.1.y

Thanks,

> 
> If that happens again, I'll try to provide more information.
> > 
> > > 
> > > Philippe
> 
> -- 
> Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles
> 
> ------------------------------------------------------------------------------
> Announcing the Oxford Dictionaries API! The API offers world-renowned
> dictionary content that is easy and intuitive to access. Sign up for an
> account today to start using our lexical data to power your apps and
> projects. Get started today and enter our developer competition.
> http://sdm.link/oxford
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford

  reply	other threads:[~2017-03-09 23:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 14:24 f2fs_bug_on in init_dirty_segmap Philippe De Muyter
2017-03-08 21:52 ` Jaegeuk Kim
2017-03-09  8:42   ` Philippe De Muyter
2017-03-09 23:11     ` Jaegeuk Kim [this message]
2017-03-10  9:28       ` Philippe De Muyter
2017-03-10 18:20         ` Jaegeuk Kim
2017-03-10 18:58           ` Philippe De Muyter
2017-03-11 21:01             ` Jaegeuk Kim
2017-03-12 10:32               ` Philippe De Muyter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170309231146.GC4125@jaegeuk.local \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=phdm@macq.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).