From: Theodore Ts'o Date: Thu, 27 May 2004 00:58:45 +0000 (-0400) Subject: Fixed potential ordering constraint problem in e2fsck's journal X-Git-Tag: E2FSPROGS-1_36~158 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93effaa456e490c6dfff08287c8f5c652cac8469;p=thirdparty%2Fe2fsprogs.git Fixed potential ordering constraint problem in e2fsck's journal recovery code by implementing the sync_blockdev function. Thanks to Junfeng Yang from the Stanford Metacompilation group for pointing this out. --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 5b82955f6..30a0b9624 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,13 @@ +2004-05-11 Theodore Ts'o + + * journal.c (sync_blockdev): Flush I/O caches to preserve ordering + constraints required by the journal recovery code. Thanks + to Junfeng Yang from the Stanford Metacompilation group + for pointing this out. + + * jfs_user.h: Define sync_blockdev() as an emulated function, + instead just being a no-op. + 2004-05-04 Theodore Ts'o * unix.c (check_if_skip): If the checkinterval is zero, then diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h index 157ece18e..c38def3e5 100644 --- a/e2fsck/jfs_user.h +++ b/e2fsck/jfs_user.h @@ -41,8 +41,6 @@ struct kdev_s { typedef struct kdev_s *kdev_t; -#define fsync_no_super(dev) do {} while(0) -#define sync_blockdev(dev) do {} while(0) #define lock_buffer(bh) do {} while(0) #define unlock_buffer(bh) do {} while(0) #define buffer_req(bh) 1 @@ -107,6 +105,7 @@ _INLINE_ void do_cache_destroy(kmem_cache_t *cache) */ int journal_bmap(journal_t *journal, blk_t block, unsigned long *phys); struct buffer_head *getblk(kdev_t ctx, blk_t blocknr, int blocksize); +void sync_blockdev(kdev_t kdev); void ll_rw_block(int rw, int dummy, struct buffer_head *bh[]); void mark_buffer_dirty(struct buffer_head *bh); void mark_buffer_uptodate(struct buffer_head *bh, int val); diff --git a/e2fsck/journal.c b/e2fsck/journal.c index 59d4bdc6d..c1b43700f 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -87,6 +87,18 @@ struct buffer_head *getblk(kdev_t kdev, blk_t blocknr, int blocksize) return bh; } +void sync_blockdev(kdev_t kdev) +{ + io_channel io; + + if (kdev->k_dev == K_DEV_FS) + io = kdev->k_ctx->fs->io; + else + io = kdev->k_ctx->journal_io; + + io_channel_flush(io); +} + void ll_rw_block(int rw, int nr, struct buffer_head *bhp[]) { int retval;