From e2b4a521e260cb7b121dc51d4c29d4d47b7c1e1e Mon Sep 17 00:00:00 2001 From: Alexey Lyashkov Date: Wed, 1 Aug 2018 18:52:28 +0300 Subject: [PATCH] LU-11020 osd: use right sync use a sync_fs instead of journal flush only. ext4 commit with similar change commit 06a407f13daf9e48f0ef7189c7e54082b53940c7 Author: Dmitry Monakhov Date: Wed Jun 12 22:25:07 2013 -0400 ext4: fix data integrity for ext4_sync_fs Inode's data or non journaled quota may be written w/o jounral so we _must_ send a barrier at the end of ext4_sync_fs. But it can be skipped if journal commit will do it for us. Cray-bug-id: LUS-5993 Signed-off-by: Alexey Lyashkov Change-Id: Ie242b48d0b8ad61cf4d38ac0fb173176193716d9 Reviewed-on: https://review.whamcloud.com/32866 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_handler.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 006995f..2ca791a 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2340,10 +2340,12 @@ static void osd_conf_get(const struct lu_env *env, static int osd_sync(const struct lu_env *env, struct dt_device *d) { int rc; + struct super_block *s = osd_sb(osd_dt_dev(d)); + ENTRY; - CDEBUG(D_CACHE, "%s: syncing OSD\n", osd_dt_dev(d)->od_svname); - - rc = ldiskfs_force_commit(osd_sb(osd_dt_dev(d))); + down_read(&s->s_umount); + rc = s->s_op->sync_fs(s, 1); + up_read(&s->s_umount); CDEBUG(D_CACHE, "%s: synced OSD: rc = %d\n", osd_dt_dev(d)->od_svname, rc); -- 1.8.3.1