All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, chao@kernel.org
Subject: Re: [PATCH] Revert "f2fs: give a warning only for readonly partition"
Date: Tue, 23 Mar 2021 21:22:01 -0700	[thread overview]
Message-ID: <YFq+aQW7eihFuSst@google.com> (raw)
In-Reply-To: <107e671d-68ea-1a74-521e-ab2b6fe36416@huawei.com>

On 03/24, Chao Yu wrote:
> On 2021/3/24 2:39, Jaegeuk Kim wrote:
> > On 03/23, Chao Yu wrote:
> > > This reverts commit 938a184265d75ea474f1c6fe1da96a5196163789.
> > > 
> > > Because that commit fails generic/050 testcase which expect failure
> > > during mount a recoverable readonly partition.
> > 
> > I think we need to change generic/050, since f2fs can recover this partition,
> 
> Well, not sure we can change that testcase, since it restricts all generic
> filesystems behavior. At least, ext4's behavior makes sense to me:
> 
> 	journal_dev_ro = bdev_read_only(journal->j_dev);
> 	really_read_only = bdev_read_only(sb->s_bdev) | journal_dev_ro;
> 
> 	if (journal_dev_ro && !sb_rdonly(sb)) {
> 		ext4_msg(sb, KERN_ERR,
> 			 "journal device read-only, try mounting with '-o ro'");
> 		err = -EROFS;
> 		goto err_out;
> 	}
> 
> 	if (ext4_has_feature_journal_needs_recovery(sb)) {
> 		if (sb_rdonly(sb)) {
> 			ext4_msg(sb, KERN_INFO, "INFO: recovery "
> 					"required on readonly filesystem");
> 			if (really_read_only) {
> 				ext4_msg(sb, KERN_ERR, "write access "
> 					"unavailable, cannot proceed "
> 					"(try mounting with noload)");
> 				err = -EROFS;
> 				goto err_out;
> 			}
> 			ext4_msg(sb, KERN_INFO, "write access will "
> 			       "be enabled during recovery");
> 		}
> 	}
> 
> > even though using it as readonly. And, valid checkpoint can allow for user to
> > read all the data without problem.
> 
> >>   		if (f2fs_hw_is_readonly(sbi)) {
> 
> Since device is readonly now, all write to the device will fail, checkpoint can
> not persist recovered data, after page cache is expired, user can see stale data.

My point is, after mount with ro, there'll be no data write which preserves the
current status. So, in the next time, we can recover fsync'ed data later, if
user succeeds to mount as rw. Another point is, with the current checkpoint, we
should not have any corrupted metadata. So, why not giving a chance to show what
data remained to user? I think this can be doable only with CoW filesystems.

> 
> Am I missing something?
> 
> Thanks,
> 
> > 
> > > 
> > > Fixes: 938a184265d7 ("f2fs: give a warning only for readonly partition")
> > > Signed-off-by: Chao Yu <yuchao0@huawei.com>
> > > ---
> > >   fs/f2fs/super.c | 8 +++++---
> > >   1 file changed, 5 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > > index b48281642e98..2b78ee11f093 100644
> > > --- a/fs/f2fs/super.c
> > > +++ b/fs/f2fs/super.c
> > > @@ -3952,10 +3952,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> > >   		 * previous checkpoint was not done by clean system shutdown.
> > >   		 */
> > >   		if (f2fs_hw_is_readonly(sbi)) {
> > > -			if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))
> > > +			if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) {
> > > +				err = -EROFS;
> > >   				f2fs_err(sbi, "Need to recover fsync data, but write access unavailable");
> > > -			else
> > > -				f2fs_info(sbi, "write access unavailable, skipping recovery");
> > > +				goto free_meta;
> > > +			}
> > > +			f2fs_info(sbi, "write access unavailable, skipping recovery");
> > >   			goto reset_checkpoint;
> > >   		}
> > > -- 
> > > 2.29.2
> > .
> > 

WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] Revert "f2fs: give a warning only for readonly partition"
Date: Tue, 23 Mar 2021 21:22:01 -0700	[thread overview]
Message-ID: <YFq+aQW7eihFuSst@google.com> (raw)
In-Reply-To: <107e671d-68ea-1a74-521e-ab2b6fe36416@huawei.com>

On 03/24, Chao Yu wrote:
> On 2021/3/24 2:39, Jaegeuk Kim wrote:
> > On 03/23, Chao Yu wrote:
> > > This reverts commit 938a184265d75ea474f1c6fe1da96a5196163789.
> > > 
> > > Because that commit fails generic/050 testcase which expect failure
> > > during mount a recoverable readonly partition.
> > 
> > I think we need to change generic/050, since f2fs can recover this partition,
> 
> Well, not sure we can change that testcase, since it restricts all generic
> filesystems behavior. At least, ext4's behavior makes sense to me:
> 
> 	journal_dev_ro = bdev_read_only(journal->j_dev);
> 	really_read_only = bdev_read_only(sb->s_bdev) | journal_dev_ro;
> 
> 	if (journal_dev_ro && !sb_rdonly(sb)) {
> 		ext4_msg(sb, KERN_ERR,
> 			 "journal device read-only, try mounting with '-o ro'");
> 		err = -EROFS;
> 		goto err_out;
> 	}
> 
> 	if (ext4_has_feature_journal_needs_recovery(sb)) {
> 		if (sb_rdonly(sb)) {
> 			ext4_msg(sb, KERN_INFO, "INFO: recovery "
> 					"required on readonly filesystem");
> 			if (really_read_only) {
> 				ext4_msg(sb, KERN_ERR, "write access "
> 					"unavailable, cannot proceed "
> 					"(try mounting with noload)");
> 				err = -EROFS;
> 				goto err_out;
> 			}
> 			ext4_msg(sb, KERN_INFO, "write access will "
> 			       "be enabled during recovery");
> 		}
> 	}
> 
> > even though using it as readonly. And, valid checkpoint can allow for user to
> > read all the data without problem.
> 
> >>   		if (f2fs_hw_is_readonly(sbi)) {
> 
> Since device is readonly now, all write to the device will fail, checkpoint can
> not persist recovered data, after page cache is expired, user can see stale data.

My point is, after mount with ro, there'll be no data write which preserves the
current status. So, in the next time, we can recover fsync'ed data later, if
user succeeds to mount as rw. Another point is, with the current checkpoint, we
should not have any corrupted metadata. So, why not giving a chance to show what
data remained to user? I think this can be doable only with CoW filesystems.

> 
> Am I missing something?
> 
> Thanks,
> 
> > 
> > > 
> > > Fixes: 938a184265d7 ("f2fs: give a warning only for readonly partition")
> > > Signed-off-by: Chao Yu <yuchao0@huawei.com>
> > > ---
> > >   fs/f2fs/super.c | 8 +++++---
> > >   1 file changed, 5 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > > index b48281642e98..2b78ee11f093 100644
> > > --- a/fs/f2fs/super.c
> > > +++ b/fs/f2fs/super.c
> > > @@ -3952,10 +3952,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> > >   		 * previous checkpoint was not done by clean system shutdown.
> > >   		 */
> > >   		if (f2fs_hw_is_readonly(sbi)) {
> > > -			if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))
> > > +			if (!is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) {
> > > +				err = -EROFS;
> > >   				f2fs_err(sbi, "Need to recover fsync data, but write access unavailable");
> > > -			else
> > > -				f2fs_info(sbi, "write access unavailable, skipping recovery");
> > > +				goto free_meta;
> > > +			}
> > > +			f2fs_info(sbi, "write access unavailable, skipping recovery");
> > >   			goto reset_checkpoint;
> > >   		}
> > > -- 
> > > 2.29.2
> > .
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2021-03-24  4:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  6:41 [PATCH] Revert "f2fs: give a warning only for readonly partition" Chao Yu
2021-03-23  6:41 ` [f2fs-dev] " Chao Yu
2021-03-23 18:39 ` Jaegeuk Kim
2021-03-23 18:39   ` [f2fs-dev] " Jaegeuk Kim
2021-03-24  1:57   ` Chao Yu
2021-03-24  1:57     ` [f2fs-dev] " Chao Yu
2021-03-24  4:22     ` Jaegeuk Kim [this message]
2021-03-24  4:22       ` Jaegeuk Kim
2021-03-24  7:48       ` Chao Yu
2021-03-24  7:48         ` [f2fs-dev] " Chao Yu
2021-03-24 22:44         ` Jaegeuk Kim
2021-03-24 22:44           ` [f2fs-dev] " Jaegeuk Kim
2021-03-25  1:59           ` Chao Yu
2021-03-25  1:59             ` [f2fs-dev] " Chao Yu
2021-03-26  1:08             ` Chao Yu
2021-03-26  1:08               ` Chao Yu
2021-03-26  1:19               ` Jaegeuk Kim
2021-03-26  1:19                 ` Jaegeuk Kim
2021-03-26  1:34                 ` Chao Yu
2021-03-26  1:34                   ` Chao Yu
2021-03-26 17:30                   ` Jaegeuk Kim
2021-03-26 17:30                     ` Jaegeuk Kim
2021-03-27  1:52                     ` Chao Yu
2021-03-27  1:52                       ` Chao Yu
2021-03-27 10:03                       ` Chao Yu
2021-03-27 10:03                         ` Chao Yu
2021-03-31  1:57                         ` Jaegeuk Kim
2021-03-31  1:57                           ` Jaegeuk Kim
2021-03-31  3:17                           ` Chao Yu
2021-03-31  3:17                             ` Chao Yu

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=YFq+aQW7eihFuSst@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.