From fe486c9894aa1d2275b66b3b3b0baee69a016afa Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Thu, 23 Oct 2014 01:34:26 +0800 Subject: [PATCH] LU-6075 osd: race for check/chance od_dirent_journal Originally, the osd_device::od_dirent_journal was a bit variable, changing such variable can happen when other is changing other bit that is in the same integer in parallel. Because there is no lock protection when change the bits, one thread changing may overwrite others. So split the osd_device::od_dirent_journal as independent variable. Signed-off-by: Fan Yong Change-Id: I859932290ebf3b94be4f588f8e3e9635fe204d49 Reviewed-on: http://review.whamcloud.com/13311 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Liang Zhen Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_handler.c | 10 +++++----- lustre/osd-ldiskfs/osd_internal.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index db71792..2f93f70 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -5379,7 +5379,7 @@ osd_dirent_check_repair(const struct lu_env *env, struct osd_object *obj, osd_dto_credits_noquota[DTO_INDEX_INSERT] + 1 + 1 + 2; again: - if (dev->od_dirent_journal) { + if (dev->od_dirent_journal != 0) { jh = osd_journal_start_sb(sb, LDISKFS_HT_MISC, credits); if (IS_ERR(jh)) { rc = PTR_ERR(jh); @@ -5455,7 +5455,7 @@ again: GOTO(out_inode, rc = 0); } - if (!dev->od_dirent_journal) { + if (dev->od_dirent_journal == 0) { iput(inode); brelse(bh); if (hlock != NULL) @@ -5487,7 +5487,7 @@ again: GOTO(out_inode, rc = 0); } - if (!dev->od_dirent_journal) { + if (dev->od_dirent_journal == 0) { iput(inode); brelse(bh); if (hlock != NULL) @@ -5526,7 +5526,7 @@ again: GOTO(out_inode, rc = 0); } - if (!dev->od_dirent_journal) { + if (dev->od_dirent_journal == 0) { iput(inode); brelse(bh); if (hlock != NULL) @@ -5579,7 +5579,7 @@ out_journal: if (hlock != NULL) { ldiskfs_htree_unlock(hlock); } else { - if (dev->od_dirent_journal) + if (dev->od_dirent_journal != 0) up_write(&obj->oo_ext_idx_sem); else up_read(&obj->oo_ext_idx_sem); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index f4b03f8..f6a04a3 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -234,19 +234,19 @@ struct osd_device { unsigned int od_fl_capa:1, od_maybe_new:1, od_noscrub:1, - od_dirent_journal:1, od_igif_inoi:1, od_check_ff:1, od_is_ost:1, od_lma_self_repair:1; - unsigned long od_capa_timeout; - __u32 od_capa_alg; - struct lustre_capa_key *od_capa_keys; + unsigned long od_capa_timeout; + __u32 od_capa_alg; + __u32 od_dirent_journal; + struct lustre_capa_key *od_capa_keys; struct hlist_head *od_capa_hash; struct proc_dir_entry *od_proc_entry; - struct lprocfs_stats *od_stats; + struct lprocfs_stats *od_stats; spinlock_t od_osfs_lock; -- 1.8.3.1