btrfs: log message when rw remount is attempted with unclean tree-log
authorDavid Sterba <dsterba@suse.com>
Wed, 5 Feb 2020 16:12:28 +0000 (17:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Feb 2020 14:42:13 +0000 (15:42 +0100)
commit 10a3a3edc5b89a8cd095bc63495fb1e0f42047d9 upstream.

A remount to a read-write filesystem is not safe when there's tree-log
to be replayed. Files that could be opened until now might be affected
by the changes in the tree-log.

A regular mount is needed to replay the log so the filesystem presents
the consistent view with the pending changes included.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/super.c

index 0c71cdd3f98bea48b93be3bbd773a4a823965d91..9286603a6a98b9bd41ec6ee41f95b1469087e1e1 100644 (file)
@@ -1809,6 +1809,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
                }
 
                if (btrfs_super_log_root(fs_info->super_copy) != 0) {
+                       btrfs_warn(fs_info,
+               "mount required to replay tree-log, cannot remount read-write");
                        ret = -EINVAL;
                        goto restore;
                }