Whamcloud - gitweb
Fixed potential ordering constraint problem in e2fsck's journal
authorTheodore Ts'o <tytso@mit.edu>
Thu, 27 May 2004 00:58:45 +0000 (20:58 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 27 May 2004 00:58:45 +0000 (20:58 -0400)
recovery code by implementing the sync_blockdev function.  Thanks to
Junfeng Yang from the Stanford Metacompilation group for pointing this
out.

e2fsck/ChangeLog
e2fsck/jfs_user.h
e2fsck/journal.c

index 5b82955..30a0b96 100644 (file)
@@ -1,3 +1,13 @@
+2004-05-11  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * unix.c (check_if_skip): If the checkinterval is zero, then
index 157ece1..c38def3 100644 (file)
@@ -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);
index 59d4bdc..c1b4370 100644 (file)
@@ -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;