ceph: flush dirty inodes before proceeding with remount [Linux 5.2]

ceph: flush dirty inodes before proceeding with remount [Linux 5.2]

This Linux kernel change "ceph: flush dirty inodes before proceeding with remount" is included in the Linux 5.2 release. This change is authored by Jeff Layton <jlayton [at] kernel.org> on Tue May 7 09:20:54 2019 -0400. The commit for this change in Linux stable tree is 00abf69 (patch).

ceph: flush dirty inodes before proceeding with remount

xfstest generic/452 was triggering a "Busy inodes after umount" warning.
ceph was allowing the mount to go read-only without first flushing out
dirty inodes in the cache. Ensure we sync out the filesystem before
allowing a remount to proceed.

Cc: stable@vger.kernel.org
Link: http://tracker.ceph.com/issues/39571
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

There are 7 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/ceph/super.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 6d5bb2f..01113c8 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -845,6 +845,12 @@ static void ceph_umount_begin(struct super_block *sb)
    return;
 }

+static int ceph_remount(struct super_block *sb, int *flags, char *data)
+{
+   sync_filesystem(sb);
+   return 0;
+}
+
 static const struct super_operations ceph_super_ops = {
    .alloc_inode    = ceph_alloc_inode,
    .destroy_inode  = ceph_destroy_inode,
@@ -852,6 +858,7 @@ static void ceph_umount_begin(struct super_block *sb)
    .drop_inode = ceph_drop_inode,
    .sync_fs        = ceph_sync_fs,
    .put_super  = ceph_put_super,
+   .remount_fs = ceph_remount,
    .show_options   = ceph_show_options,
    .statfs     = ceph_statfs,
    .umount_begin   = ceph_umount_begin,

Leave a Reply

Your email address will not be published. Required fields are marked *