f2fs: give a chance to mount again when encountering errors

This patch gives another chance to try mount process when we encounter an error.
This makes an effect on the roll-forward recovery failures as well.

Change-Id: Ie90dda2d7231fdc9cab0d5c307d2f6f7e9e7aeff
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs: introduce f2fs_cp_error for readability

This patch adds f2fs_cp_error for readability.

Change-Id: I1041ab4bdb57db1c5e06accdfdca91bd10439cdf
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs: unlock_page when node page is redirtied out

This patch fixes missing unlock_page when a node page is redirtied out.

Change-Id: I94ae456f8eebbe6a3ff3ce857add3615052335bc
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs: check s_dirty under cp_mutex

It needs to check s_dirty under cp_mutex, since s_dirty is reset under that
mutex.
And previous condition was not correct, since we can omit doing checkpoint
when checkpoint was done followed by all the node pages were written back.

Change-Id: Iae6f12f0ba6f2732a9ae337da281431db0bb3cdd
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs: handle EIO not to break fs consistency

There are two rules when EIO is occurred.
1. don't write any checkpoint data to preserve the previous checkpoint
2. don't lose the cached dentry/node/meta pages

So, at first, this patch adds set_page_dirty in f2fs_write_end_io's failure.
Then, writing checkpoint/dentry/node blocks is not allowed.

Note that, for the data pages, we can't just throw away by redirtying them.
Otherwise, kworker can fall into infinite loop to flush them.
(Ref. xfstests/019)

Change-Id: I0d792f8b575249fb9620784ace7d401b09f73a23
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs: add WARN_ON in f2fs_bug_on

This patch adds WARN_ON when f2fs_bug_on is disable to see kernel messages.

Change-Id: I4179a5835836b69ecdd8114dc0d79da5c750ba41
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>