1. 31 Jul, 2012 2 commits
    • Jan Kara's avatar
      fs: Improve filesystem freezing handling · 5accdf82
      Jan Kara authored
      vfs_check_frozen() tests are racy since the filesystem can be frozen just after
      the test is performed. Thus in write paths we can end up marking some pages or
      inodes dirty even though the file system is already frozen. This creates
      problems with flusher thread hanging on frozen filesystem.
      
      Another problem is that exclusion between ->page_mkwrite() and filesystem
      freezing has been handled by setting page dirty and then verifying s_frozen.
      This guaranteed that either the freezing code sees the faulted page, writes it,
      and writeprotects it again or we see s_frozen set and bail out of page fault.
      This works to protect from page being marked writeable while filesystem
      freezing is running but has an unpleasant artefact of leaving dirty (although
      unmodified and writeprotected) pages on frozen filesystem resulting in similar
      problems with flusher thread as the first problem.
      
      This patch aims at providing exclusion between write paths and filesystem
      freezing. We implement a writer-freeze read-write semaphore in the superblock.
      Actually, there are three such semaphores because of lock ranking reasons - one
      for page fault handlers (->page_mkwrite), one for all other writers, and one of
      internal filesystem purposes (used e.g. to track running transactions).  Write
      paths which should block freezing (e.g. directory operations, ->aio_write(),
      ->page_mkwrite) hold reader side of the semaphore. Code freezing the filesystem
      takes the writer side.
      
      Only that we don't really want to bounce cachelines of the semaphores between
      CPUs for each write happening. So we implement the reader side of the semaphore
      as a per-cpu counter and the writer side is implemented using s_writers.frozen
      superblock field.
      
      [AV: microoptimize sb_start_write(); we want it fast in normal case]
      
      BugLink: https://bugs.launchpad.net/bugs/897421Tested-by: default avatarKamal Mostafa <kamal@canonical.com>
      Tested-by: default avatarPeter M. Petrakis <peter.petrakis@canonical.com>
      Tested-by: default avatarDann Frazier <dann.frazier@canonical.com>
      Tested-by: default avatarMassimo Morana <massimo.morana@canonical.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      5accdf82
    • Al Viro's avatar
      switch the protection of percpu_counter list to spinlock · d87aae2f
      Al Viro authored
      ... making percpu_counter_destroy() non-blocking
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      d87aae2f
  2. 30 Jul, 2012 14 commits
  3. 29 Jul, 2012 23 commits
  4. 22 Jul, 2012 1 commit