1. 03 4月, 2009 1 次提交
    • W
      vfs: skip I_CLEAR state inodes · b6fac63c
      Wu Fengguang 提交于
      clear_inode() will switch inode state from I_FREEING to I_CLEAR, and do so
      _outside_ of inode_lock.  So any I_FREEING testing is incomplete without a
      coupled testing of I_CLEAR.
      
      So add I_CLEAR tests to drop_pagecache_sb(), generic_sync_sb_inodes() and
      add_dquot_ref().
      
      Masayoshi MIZUMA discovered the bug in drop_pagecache_sb() and Jan Kara
      reminds fixing the other two cases.
      
      Masayoshi MIZUMA has a nice panic flow:
      
      =====================================================================
                  [process A]               |        [process B]
       |                                    |
       |    prune_icache()                  | drop_pagecache()
       |      spin_lock(&inode_lock)        |   drop_pagecache_sb()
       |      inode->i_state |= I_FREEING;  |       |
       |      spin_unlock(&inode_lock)      |       V
       |          |                         |     spin_lock(&inode_lock)
       |          V                         |         |
       |      dispose_list()                |         |
       |        list_del()                  |         |
       |        clear_inode()               |         |
       |          inode->i_state = I_CLEAR  |         |
       |            |                       |         V
       |            |                       |      if (inode->i_state & (I_FREEING|I_WILL_FREE))
       |            |                       |              continue;           <==== NOT MATCH
       |            |                       |
       |            |                       | (DANGER from here on! Accessing disposing inode!)
       |            |                       |
       |            |                       |      __iget()
       |            |                       |        list_move() <===== PANIC on poisoned list !!
       V            V                       |
      (time)
      =====================================================================
      Reported-by: NMasayoshi MIZUMA <m.mizuma@jp.fujitsu.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b6fac63c
  2. 13 3月, 2009 1 次提交
    • N
      fs: new inode i_state corruption fix · 7ef0d737
      Nick Piggin 提交于
      There was a report of a data corruption
      http://lkml.org/lkml/2008/11/14/121.  There is a script included to
      reproduce the problem.
      
      During testing, I encountered a number of strange things with ext3, so I
      tried ext2 to attempt to reduce complexity of the problem.  I found that
      fsstress would quickly hang in wait_on_inode, waiting for I_LOCK to be
      cleared, even though instrumentation showed that unlock_new_inode had
      already been called for that inode.  This points to memory scribble, or
      synchronisation problme.
      
      i_state of I_NEW inodes is not protected by inode_lock because other
      processes are not supposed to touch them until I_LOCK (and I_NEW) is
      cleared.  Adding WARN_ON(inode->i_state & I_NEW) to sites where we modify
      i_state revealed that generic_sync_sb_inodes is picking up new inodes from
      the inode lists and passing them to __writeback_single_inode without
      waiting for I_NEW.  Subsequently modifying i_state causes corruption.  In
      my case it would look like this:
      
      CPU0                            CPU1
      unlock_new_inode()              __sync_single_inode()
       reg <- inode->i_state
       reg -> reg & ~(I_LOCK|I_NEW)   reg <- inode->i_state
       reg -> inode->i_state          reg -> reg | I_SYNC
                                      reg -> inode->i_state
      
      Non-atomic RMW on CPU1 overwrites CPU0 store and sets I_LOCK|I_NEW again.
      
      Fix for this is rather than wait for I_NEW inodes, just skip over them:
      inodes concurrently being created are not subject to data integrity
      operations, and should not significantly contribute to dirty memory
      either.
      
      After this change, I'm unable to reproduce any of the added warnings or
      hangs after ~1hour of running.  Previously, the new warnings would start
      immediately and hang would happen in under 5 minutes.
      
      I'm also testing on ext3 now, and so far no problems there either.  I
      don't know whether this fixes the problem reported above, but it fixes a
      real problem for me.
      
      Cc: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
      Reported-by: NAdrian Hunter <ext-adrian.hunter@nokia.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: <stable@kernel.org>
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7ef0d737
  3. 07 1月, 2009 3 次提交
    • N
      fs: sys_sync fix · 856bf4d7
      Nick Piggin 提交于
      s_syncing livelock avoidance was breaking data integrity guarantee of
      sys_sync, by allowing sys_sync to skip writing or waiting for superblocks
      if there is a concurrent sys_sync happening.
      
      This livelock avoidance is much less important now that we don't have the
      get_super_to_sync() call after every sb that we sync.  This was replaced
      by __put_super_and_need_restart.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      856bf4d7
    • N
      fs: sync_sb_inodes fix · 38f21977
      Nick Piggin 提交于
      Fix data integrity semantics required by sys_sync, by iterating over all
      inodes and waiting for any writeback pages after the initial writeout.
      Comments explain the exact problem.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      38f21977
    • N
      fs: remove WB_SYNC_HOLD · 4f5a99d6
      Nick Piggin 提交于
      Remove WB_SYNC_HOLD.  The primary motiviation is the design of my
      anti-starvation code for fsync.  It requires taking an inode lock over the
      sync operation, so we could run into lock ordering problems with multiple
      inodes.  It is possible to take a single global lock to solve the ordering
      problem, but then that would prevent a future nice implementation of "sync
      multiple inodes" based on lock order via inode address.
      
      Seems like a backward step to remove this, but actually it is busted
      anyway: we can't use the inode lists for data integrity wait: an inode can
      be taken off the dirty lists but still be under writeback.  In order to
      satisfy data integrity semantics, we should wait for it to finish
      writeback, but if we only search the dirty lists, we'll miss it.
      
      It would be possible to have a "writeback" list, for sys_sync, I suppose.
      But why complicate things by prematurely optimise?  For unmounting, we
      could avoid the "livelock avoidance" code, which would be easier, but
      again premature IMO.
      
      Fixing the existing data integrity problem will come next.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4f5a99d6
  4. 17 10月, 2008 1 次提交
  5. 15 7月, 2008 2 次提交
  6. 29 4月, 2008 1 次提交
  7. 20 3月, 2008 1 次提交
    • R
      fs: fix kernel-doc notation warnings · a6b91919
      Randy Dunlap 提交于
      Fix kernel-doc notation warnings in fs/.
      
      Warning(mmotm-2008-0314-1449//fs/super.c:560): missing initial short description on line:
       *	mark_files_ro
      Warning(mmotm-2008-0314-1449//fs/locks.c:1277): missing initial short description on line:
       *	lease_get_mtime
      Warning(mmotm-2008-0314-1449//fs/locks.c:1277): missing initial short description on line:
       *	lease_get_mtime
      Warning(mmotm-2008-0314-1449//fs/namei.c:1368): missing initial short description on line:
       * lookup_one_len:  filesystem helper to lookup single pathname component
      Warning(mmotm-2008-0314-1449//fs/buffer.c:3221): missing initial short description on line:
       * bh_uptodate_or_lock: Test whether the buffer is uptodate
      Warning(mmotm-2008-0314-1449//fs/buffer.c:3240): missing initial short description on line:
       * bh_submit_read: Submit a locked buffer for reading
      Warning(mmotm-2008-0314-1449//fs/fs-writeback.c:30): missing initial short description on line:
       * writeback_acquire: attempt to get exclusive writeback access to a device
      Warning(mmotm-2008-0314-1449//fs/fs-writeback.c:47): missing initial short description on line:
       * writeback_in_progress: determine whether there is writeback in progress
      Warning(mmotm-2008-0314-1449//fs/fs-writeback.c:58): missing initial short description on line:
       * writeback_release: relinquish exclusive writeback access against a device.
      Warning(mmotm-2008-0314-1449//include/linux/jbd.h:351): contents before sections
      Warning(mmotm-2008-0314-1449//include/linux/jbd.h:561): contents before sections
      Warning(mmotm-2008-0314-1449//fs/jbd/transaction.c:1935): missing initial short description on line:
       * void journal_invalidatepage()
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a6b91919
  8. 09 2月, 2008 1 次提交
  9. 07 2月, 2008 1 次提交
  10. 06 2月, 2008 2 次提交
    • F
      writeback: speed up writeback of big dirty files · 8bc3be27
      Fengguang Wu 提交于
      After making dirty a 100M file, the normal behavior is to start the
      writeback for all data after 30s delays.  But sometimes the following
      happens instead:
      
      	- after 30s:    ~4M
      	- after 5s:     ~4M
      	- after 5s:     all remaining 92M
      
      Some analyze shows that the internal io dispatch queues goes like this:
      
      		s_io            s_more_io
      		-------------------------
      	1)	100M,1K         0
      	2)	1K              96M
      	3)	0               96M
      1) initial state with a 100M file and a 1K file
      
      2) 4M written, nr_to_write <= 0, so write more
      
      3) 1K written, nr_to_write > 0, no more writes(BUG)
      
      nr_to_write > 0 in (3) fools the upper layer to think that data have all
      been written out.  The big dirty file is actually still sitting in
      s_more_io.  We cannot simply splice s_more_io back to s_io as soon as s_io
      becomes empty, and let the loop in generic_sync_sb_inodes() continue: this
      may starve newly expired inodes in s_dirty.  It is also not an option to
      draw inodes from both s_more_io and s_dirty, an let the loop go on: this
      might lead to live locks, and might also starve other superblocks in sync
      time(well kupdate may still starve some superblocks, that's another bug).
      
      We have to return when a full scan of s_io completes.  So nr_to_write > 0
      does not necessarily mean that "all data are written".  This patch
      introduces a flag writeback_control.more_io to indicate that more io should
      be done.  With it the big dirty file no longer has to wait for the next
      kupdate invokation 5s later.
      
      In sync_sb_inodes() we only set more_io on super_blocks we actually
      visited.  This avoids the interaction between two pdflush deamons.
      
      Also in __sync_single_inode() we don't blindly keep requeuing the io if the
      filesystem cannot progress.  Failing to do so may lead to 100% iowait.
      Tested-by: NMike Snitzer <snitzer@gmail.com>
      Signed-off-by: NFengguang Wu <wfg@mail.ustc.edu.cn>
      Cc: Michael Rubin <mrubin@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8bc3be27
    • Q
      skip writing data pages when inode is under I_SYNC · 2d544564
      Qi Yong 提交于
      Since I_SYNC was split out from I_LOCK, the concern in commit
      4b89eed9 ("Write back inode data pages
      even when the inode itself is locked") is not longer valid.
      
      We should revert to the original behavior: in __writeback_single_inode(),
      when we find an I_SYNC-ed inode and we're not doing a data-integrity sync,
      skip writing entirely.  Otherwise, we are double calling do_writepages()
      Signed-off-by: NQi Yong <qiyong@fc-cn.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hugh Dickins <hugh@veritas.com>
      Cc: Joern Engel <joern@wohnheim.fh-wedel.de>
      Cc: WU Fengguang <wfg@mail.ustc.edu.cn>
      Cc: Michael Rubin <mrubin@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2d544564
  11. 15 1月, 2008 1 次提交
  12. 20 10月, 2007 1 次提交
  13. 17 10月, 2007 13 次提交
    • J
      introduce I_SYNC · 1c0eeaf5
      Joern Engel 提交于
      I_LOCK was used for several unrelated purposes, which caused deadlock
      situations in certain filesystems as a side effect.  One of the purposes
      now uses the new I_SYNC bit.
      
      Also document the various bits and change their order from historical to
      logical.
      
      [bunk@stusta.de: make fs/inode.c:wake_up_inode() static]
      Signed-off-by: NJoern Engel <joern@wohnheim.fh-wedel.de>
      Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
      Cc: David Chinner <dgc@sgi.com>
      Cc: Anton Altaparmakov <aia21@cam.ac.uk>
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1c0eeaf5
    • F
      writeback: introduce writeback_control.more_io to indicate more io · 2e6883bd
      Fengguang Wu 提交于
      After making dirty a 100M file, the normal behavior is to start the writeback
      for all data after 30s delays.  But sometimes the following happens instead:
      
      	- after 30s:    ~4M
      	- after 5s:     ~4M
      	- after 5s:     all remaining 92M
      
      Some analyze shows that the internal io dispatch queues goes like this:
      
      		s_io            s_more_io
      		-------------------------
      	1)	100M,1K         0
      	2)	1K              96M
      	3)	0               96M
      
      1) initial state with a 100M file and a 1K file
      2) 4M written, nr_to_write <= 0, so write more
      3) 1K written, nr_to_write > 0, no more writes(BUG)
      
      nr_to_write > 0 in (3) fools the upper layer to think that data have all been
      written out.  The big dirty file is actually still sitting in s_more_io.  We
      cannot simply splice s_more_io back to s_io as soon as s_io becomes empty, and
      let the loop in generic_sync_sb_inodes() continue: this may starve newly
      expired inodes in s_dirty.  It is also not an option to draw inodes from both
      s_more_io and s_dirty, an let the loop go on: this might lead to live locks,
      and might also starve other superblocks in sync time(well kupdate may still
      starve some superblocks, that's another bug).
      
      We have to return when a full scan of s_io completes.  So nr_to_write > 0 does
      not necessarily mean that "all data are written".  This patch introduces a
      flag writeback_control.more_io to indicate this situation.  With it the big
      dirty file no longer has to wait for the next kupdate invocation 5s later.
      
      Cc: David Chinner <dgc@sgi.com>
      Cc: Ken Chen <kenchen@google.com>
      Signed-off-by: NFengguang Wu <wfg@mail.ustc.edu.cn>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2e6883bd
    • F
      writeback: fix ntfs with sb_has_dirty_inodes() · 08d8e974
      Fengguang Wu 提交于
      NTFS's if-condition on dirty inodes is not complete.  Fix it with
      sb_has_dirty_inodes().
      
      Cc: Anton Altaparmakov <aia21@cantab.net>
      Cc: Ken Chen <kenchen@google.com>
      Signed-off-by: NFengguang Wu <wfg@mail.ustc.edu.cn>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      08d8e974
    • F
      writeback: fix time ordering of the per superblock inode lists 8 · 2c136579
      Fengguang Wu 提交于
      Streamline the management of dirty inode lists and fix time ordering bugs.
      
      The writeback logic used to move not-yet-expired dirty inodes from s_dirty to
      s_io, *only to* move them back.  The move-inodes-back-and-forth thing is a
      mess, which is eliminated by this patch.
      
      The new scheme is:
      - s_dirty acts as a time ordered io delaying queue;
      - s_io/s_more_io together acts as an io dispatching queue.
      
      On kupdate writeback, we pull some inodes from s_dirty to s_io at the start of
      every full scan of s_io.  Otherwise  (i.e. for sync/throttle/background
      writeback), we always pull from s_dirty on each run (a partial scan).
      
      Note that the line
      	list_splice_init(&sb->s_more_io, &sb->s_io);
      is moved to queue_io() to leave s_io empty. Otherwise a big dirtied file will
      sit in s_io for a long time, preventing new expired inodes to get in.
      
      Cc: Ken Chen <kenchen@google.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NFengguang Wu <wfg@mail.ustc.edu.cn>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2c136579
    • K
      writeback: fix periodic superblock dirty inode flushing · 0e0f4fc2
      Ken Chen 提交于
      Current -mm tree has bucketful of bug fixes in periodic writeback path.
      However, we still hit a glitch where dirty pages on a given inode aren't
      completely flushed to the disk, and system will accumulate large amount of
      dirty pages beyond what dirty_expire_interval is designed for.
      
      The problem is __sync_single_inode() will move an inode to sb->s_dirty list
      even when there are more pending dirty pages on that inode.  If there is
      another inode with a small number of dirty pages, we hit a case where the loop
      iteration in wb_kupdate() terminates prematurely because wbc.nr_to_write > 0.
      Thus leaving the inode that has large amount of dirty pages behind and it has
      to wait for another dirty_writeback_interval before we flush it again.  We
      effectively only write out MAX_WRITEBACK_PAGES every dirty_writeback_interval.
      If the rate of dirtying is sufficiently high, the system will start
      accumulate a large number of dirty pages.
      
      So fix it by having another sb->s_more_io list on which to park the inode
      while we iterate through sb->s_io and to allow each dirty inode which resides
      on that sb to have an equal chance of flushing some amount of dirty pages.
      Signed-off-by: NKen Chen <kenchen@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0e0f4fc2
    • A
      writeback: fix time ordering of the per superblock dirty inode lists 7 · 670e4def
      Andrew Morton 提交于
      This one fixes four bugs.
      
      There are a few situation in there where writeback decides it is going to skip
      over a blockdev inode on the kernel-internal blockdev superblock.  It
      presently does this by moving the blockdev inode onto the tail of the blockdev
      superblock's s_dirty.  But
      
      a) this screws up s_dirty's reverse-time-orderedness and
      
      b) refiling the blockdev for writeback in another 30 second is rude.  We
         should try again sooner than that.
      
      Fix all this up by using redirty_head(): move the blockdev inode onto the head
      of the blockdev superblock's s_dirty list for prompt writeback.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      670e4def
    • A
      writeback: fix time ordering of the per superblock dirty inode lists 6 · 65cb9b47
      Andrew Morton 提交于
      Recycling the previous changelog:
      
        When the writeback function is operating in writeback-for-flushing mode
        (as opposed to writeback-for-integrity) and it encounters an I_LOCKed inode,
        it will skip writing that inode.  This is done for throughput and latency:
        move on to another inode rather than blocking for this one.
      
        Writeback skips this inode by moving it off s_io and onto s_dirty, so that
        writeback can proceed with the other inodes on s_io.
      
        However that inode movement can corrupt s_dirty's
        reverse-time-orderedness.  Fix that by using the new redirty_tail(), which
        will update the refiled inode's dirtied_when field.
      
        Note: the behaviour in here is a bit rude: if kupdate happens to come
        across a locked inode then it will defer writeback of that inode for another
        30 seconds.  We'll address that in the next patch.
      
      Address that here.  What we do is to move the skipped inode to the _head_ of
      s_dirty, immediately eligible for writeout again.  Instead of deferring that
      writeout for another 30 seconds.
      
      One would think that this might cause a livelock: we keep on trying to write
      the same locked inode.  But it won't because:
      
      a) if that was the case, it would _already_ be happening on the
         balance_dirty_pages codepath.  Because balance_dirty_pages() doesn't care
         about inode timestamps.
      
      b) if we skipped this inode then we won't have done any writeback.  The
         higher-level writeback paths will see that wbc.nr_to_write didn't change
         and they'll then back off and take a nap.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      65cb9b47
    • A
      writeback: fix time ordering of the per superblock dirty inode lists 5 · c6945e77
      Andrew Morton 提交于
      When the writeback function is operating in writeback-for-flushing mode (as
      opposed to writeback-for-integrity) and it encounters an I_LOCKed inode, it
      will skip writing that inode.  This is done for throughput and latency: move
      on to another inode rather than blocking for this one.
      
      Writeback skips this inode by moving it off s_io and onto s_dirty, so that
      writeback can proceed with the other inodes on s_io.
      
      However that inode movement can corrupt s_dirty's reverse-time-orderedness.
      Fix that by using the new redirty_tail(), which will update the refiled
      inode's dirtied_when field.
      
      Note: the behaviour in here is a bit rude: if kupdate happens to come across a
      locked inode then it will defer writeback of that inode for another 30
      seconds.  We'll address that in the next patch.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c6945e77
    • A
      writeback: fix comment, use helper function · 1b43ef91
      Andrew Morton 提交于
      There's a comment in there which claims that the inode is left on s_io
      if nfs chickened out of writing some data.
      
      But that's not been true for three years.
      9290280ced13c85689adeffa587e9a53bd3a5873 fixed a livelock by moving these
      inodes back onto s_dirty.  Fix the comment.
      
      In the second leg of the `if', use redirty_tail() rather than open-coding it.
      
      Add weaselly comment indicating lack of confidence in the code and lack of the
      fortitude which would be needed to fiddle with it.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1b43ef91
    • A
      writeback: fix time ordering of the per superblock dirty inode lists 4 · c986d1e2
      Andrew Morton 提交于
      When the kupdate function has tried to write back an expired inode it will
      then check to see whether some of the inode's pages are still dirty.
      
      This can happen when the filesystem decided to not write a page for some
      reason.  But it does _not_ occur due to redirtyings: a redirtying will set
      I_DIRTY_PAGES.
      
      What we need to do here is to set I_DIRTY_PAGES to reflect reality and to then
      put the inode onto the _head_ of s_dirty for consideration on the next kupdate
      pass, in five seconds time.
      
      Problem is, the code failed to modify the inode's timestamp when pushing the
      inode onto thehead of s_dirty.
      
      The patch:
      
      If there are no other inodes on s_dirty then we leave the inode's timestamp
      alone: it is already expired.
      
      If there _are_ other inodes on s_dirty then we arrange for this inode to get
      the same timestamp as the inode which is at the head of s_dirty, thus
      preserving the s_dirty ordering.  But we only need to do this if this inode
      purports to have been dirtied before the one at head-of-list.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c986d1e2
    • A
      writeback: fix time ordering of the per superblock dirty inode lists 3 · f57b9b7b
      Andrew Morton 提交于
      While writeback is working against a dirty inode it does a check after trying
      to write some of the inode's pages:
      
      "did the lower layers skip some of the inode's dirty pages because they were
      locked (or under writeback, or whatever)"
      
      If this turns out to be true, we must move the inode back onto s_dirty and
      redirty it.  The reason for doing this is that fsync() and friends only check
      the s_dirty list, and those functions want to know about those pages which
      were locked, so they can be waited upon and, if necessary, rewritten.
      
      Problem is, that redirtying was putting the inode onto the tail of s_dirty
      without updating its timestamp.  This causes a violation of s_dirty ordering.
      
      Fix this by updating inode->dirtied_when when moving the inode onto s_dirty.
      
      But the code is still a bit buggy?  If the inode was _already_ dirty then we
      don't need to move it at all.  Oh well, hopefully it doesn't matter too much,
      as that was a redirtying, which was very recent anwyay.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f57b9b7b
    • A
      writeback: fix time ordering of the per superblock dirty inode lists: memory-backed inodes · 9852a0e7
      Andrew Morton 提交于
      For reasons which escape me, inodes which are dirty against a ram-backed
      filesystem are managed in the same way as inodes which are backed by real
      devices.
      
      Probably we could optimise things here.  But given that we skip the entire
      supeblock as son as we hit the first dirty inode, there's not a lot to be
      gained.
      
      And the code does need to handle one particular non-backed superblock: the
      kernel's fake internal superblock which holds all the blockdevs.
      
      Still.  At present when the code encounters an inode which is dirty against a
      memory-backed filesystem it will skip that inode by refiling it back onto
      s_dirty.  But it fails to update the inode's timestamp when doing so which at
      least makes the debugging code upset.
      
      Fix.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9852a0e7
    • A
      writeback: fix time-ordering of the per-superblock dirty-inode lists · 6610a0bc
      Andrew Morton 提交于
      When writeback has finished writing back an inode it looks to see if that
      inode is still dirty.  If it is, that means that a process redirtied the inode
      while its writeback was in progress.
      
      What we need to do here is to refile the redirtied inode onto the s_dirty
      list.
      
      But we're doing that wrongly: it could be that this inode was redirtied
      _before_ the last inode on s_dirty.  We're blindly appending this inode to the
      list, after an inode which might be less-recently-dirtied, thus violating the
      list's ordering.
      
      So we must either insertion-sort this inode into the correct place, or we must
      update this inode's dirtied_when field when appending it to the reverse-sorted
      s_dirty list, to preserve the reverse-time-ordering.
      
      This patch does the latter: if this inode was dirtied less recently than the
      tail inode then copy the tail inode's timestamp into this inode.
      
      This means that in rare circumstances, some inodes will be writen back later
      than they should have been.  But the time slip will be small.
      
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6610a0bc
  14. 10 10月, 2007 1 次提交
  15. 27 1月, 2007 1 次提交
    • L
      Write back inode data pages even when the inode itself is locked · 4b89eed9
      Linus Torvalds 提交于
      In __writeback_single_inode(), when we find a locked inode and we're not
      doing a data-integrity sync, we used to just skip writing entirely,
      since we didn't want to wait for the inode to unlock.
      
      However, there's really no reason to skip writing the data pages, which
      are likely to be the the bulk of the dirty state anyway (and the main
      reason why writeback was started for the non-data-integrity case, of
      course!)
      Acked-by: NNick Piggin <nickpiggin@yahoo.com.au>
      Cc: Andrew Morton <akpm@osdl.org>,
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hugh Dickins <hugh@veritas.com>
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4b89eed9
  16. 01 10月, 2006 2 次提交
  17. 01 7月, 2006 2 次提交
  18. 23 6月, 2006 2 次提交
    • J
      [PATCH] Kill PF_SYNCWRITE flag · b31dc66a
      Jens Axboe 提交于
      A process flag to indicate whether we are doing sync io is incredibly
      ugly. It also causes performance problems when one does a lot of async
      io and then proceeds to sync it. Part of the io will go out as async,
      and the other part as sync. This causes a disconnect between the
      previously submitted io and the synced io. For io schedulers such as CFQ,
      this will cause us lost merges and suboptimal behaviour in scheduling.
      
      Remove PF_SYNCWRITE completely from the fsync/msync paths, and let
      the O_DIRECT path just directly indicate that the writes are sync
      by using WRITE_SYNC instead.
      Signed-off-by: NJens Axboe <axboe@suse.de>
      b31dc66a
    • O
      [PATCH] writeback: fix range handling · 111ebb6e
      OGAWA Hirofumi 提交于
      When a writeback_control's `start' and `end' fields are used to
      indicate a one-byte-range starting at file offset zero, the required
      values of .start=0,.end=0 mean that the ->writepages() implementation
      has no way of telling that it is being asked to perform a range
      request.  Because we're currently overloading (start == 0 && end == 0)
      to mean "this is not a write-a-range request".
      
      To make all this sane, the patch changes range of writeback_control.
      
      So caller does: If it is calling ->writepages() to write pages, it
      sets range (range_start/end or range_cyclic) always.
      
      And if range_cyclic is true, ->writepages() thinks the range is
      cyclic, otherwise it just uses range_start and range_end.
      
      This patch does,
      
          - Add LLONG_MAX, LLONG_MIN, ULLONG_MAX to include/linux/kernel.h
            -1 is usually ok for range_end (type is long long). But, if someone did,
      
      		range_end += val;		range_end is "val - 1"
      		u64val = range_end >> bits;	u64val is "~(0ULL)"
      
            or something, they are wrong. So, this adds LLONG_MAX to avoid nasty
            things, and uses LLONG_MAX for range_end.
      
          - All callers of ->writepages() sets range_start/end or range_cyclic.
      
          - Fix updates of ->writeback_index. It seems already bit strange.
            If it starts at 0 and ended by check of nr_to_write, this last
            index may reduce chance to scan end of file.  So, this updates
            ->writeback_index only if range_cyclic is true or whole-file is
            scanned.
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Anton Altaparmakov <aia21@cantab.net>
      Cc: Steven French <sfrench@us.ibm.com>
      Cc: "Vladimir V. Saveliev" <vs@namesys.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      111ebb6e
  19. 26 3月, 2006 1 次提交
  20. 07 11月, 2005 2 次提交