GFS2: Fix race in journal flushing
Due to the GLF_LFLUSH flag being reset for each block which exits the journal, it was possible for the journal flush to be skipped in case two flushes (one of which must be an inode specific flush) raced with each other. The simple solution is just to remove the optimisation allowing skipping of the lflush rwsem in certain cases.
We'll review this later and possibly reintroduce the optimisation but for now correctness is the more important feature.
Signed-off-by Steven Whitehouse <[email protected]>
fs/gfs2/log.c +1 -1
@@ -696,7 +696,7 @@ static void gfs2_ordered_wait(struct gfs2_sbd *sdp)* */ -void __gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl) +void gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl) {struct gfs2_ail *ai;
fs/gfs2/log.h +12 -18
@@ -47,28 +47,22 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp, sdp->sd_log_head = sdp->sd_log_tail = value; } -unsigned int gfs2_struct2blk (struct gfs2_sbd *sdp,unsigned int nstruct, -unsigned int ssize); +extern unsigned int gfs2_struct2blk (struct gfs2_sbd *sdp,unsigned int nstruct, +unsigned int ssize); -int gfs2_log_reserve (struct gfs2_sbd *sdp,unsigned int blks); -void gfs2_log_incr_head (struct gfs2_sbd *sdp); +extern int gfs2_log_reserve (struct gfs2_sbd *sdp,unsigned int blks); +extern void gfs2_log_incr_head (struct gfs2_sbd *sdp); -struct buffer_head *gfs2_log_get_buf (struct gfs2_sbd *sdp); -struct buffer_head *gfs2_log_fake_buf (struct gfs2_sbd *sdp, +extern struct buffer_head *gfs2_log_get_buf (struct gfs2_sbd *sdp); +extern struct buffer_head *gfs2_log_fake_buf (struct gfs2_sbd *sdp,struct buffer_head *real); -void __gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl); +extern void gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl); -static inline void gfs2_log_flush (struct gfs2_sbd *sbd,struct gfs2_glock *gl) -{ -if (!gl ||test_bit (GLF_LFLUSH , &gl->gl_flags)) -__gfs2_log_flush (sbd, gl); -} - -void gfs2_log_commit (struct gfs2_sbd *sdp,struct gfs2_trans *trans); -void gfs2_remove_from_ail (struct gfs2_bufdata *bd); +extern void gfs2_log_commit (struct gfs2_sbd *sdp,struct gfs2_trans *trans); +extern void gfs2_remove_from_ail (struct gfs2_bufdata *bd); -void gfs2_log_shutdown (struct gfs2_sbd *sdp); -void gfs2_meta_syncfs (struct gfs2_sbd *sdp); -int gfs2_logd (void *data); +extern void gfs2_log_shutdown (struct gfs2_sbd *sdp); +extern void gfs2_meta_syncfs (struct gfs2_sbd *sdp); +extern int gfs2_logd (void *data);#endif /* __LOG_DOT_H__ */