1. 12 1月, 2012 1 次提交
  2. 07 1月, 2012 1 次提交
  3. 04 1月, 2012 1 次提交
  4. 25 5月, 2011 1 次提交
  5. 01 4月, 2011 1 次提交
    • J
      quota: Don't write quota info in dquot_commit() · b03f2456
      Jan Kara 提交于
      There's no reason to write quota info in dquot_commit(). The writing is a
      relict from the old days when we didn't have dquot_acquire() and
      dquot_release() and thus dquot_commit() could have created / removed quota
      structures from the file. These days dquot_commit() only updates usage counters
      / limits in quota structure and thus there's no need to write quota info.
      
      This also fixes an issue with journaling filesystem which didn't reserve
      enough space in the transaction for write of quota info (it could have been
      dirty at the time of dquot_commit() because of a race with other operation
      changing it).
      
      CC: stable@kernel.org
      Reported-and-tested-by: NLukas Czerner <lczerner@redhat.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      b03f2456
  6. 31 3月, 2011 1 次提交
  7. 25 3月, 2011 2 次提交
    • D
      fs: move i_sb_list out from under inode_lock · 55fa6091
      Dave Chinner 提交于
      Protect the per-sb inode list with a new global lock
      inode_sb_list_lock and use it to protect the list manipulations and
      traversals. This lock replaces the inode_lock as the inodes on the
      list can be validity checked while holding the inode->i_lock and
      hence the inode_lock is no longer needed to protect the list.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      55fa6091
    • D
      fs: protect inode->i_state with inode->i_lock · 250df6ed
      Dave Chinner 提交于
      Protect inode state transitions and validity checks with the
      inode->i_lock. This enables us to make inode state transitions
      independently of the inode_lock and is the first step to peeling
      away the inode_lock from the code.
      
      This requires that __iget() is done atomically with i_state checks
      during list traversals so that we don't race with another thread
      marking the inode I_FREEING between the state check and grabbing the
      reference.
      
      Also remove the unlock_new_inode() memory barrier optimisation
      required to avoid taking the inode_lock when clearing I_NEW.
      Simplify the code by simply taking the inode->i_lock around the
      state change and wakeup. Because the wakeup is no longer tricky,
      remove the wake_up_inode() function and open code the wakeup where
      necessary.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      250df6ed
  8. 13 1月, 2011 1 次提交
    • J
      quota: Fix deadlock during path resolution · f00c9e44
      Jan Kara 提交于
      As Al Viro pointed out path resolution during Q_QUOTAON calls to quotactl
      is prone to deadlocks. We hold s_umount semaphore for reading during the
      path resolution and resolution itself may need to acquire the semaphore
      for writing when e. g. autofs mountpoint is passed.
      
      Solve the problem by performing the resolution before we get hold of the
      superblock (and thus s_umount semaphore). The whole thing is complicated
      by the fact that some filesystems (OCFS2) ignore the path argument. So to
      distinguish between filesystem which want the path and which do not we
      introduce new .quota_on_meta callback which does not get the path. OCFS2
      then uses this callback instead of old .quota_on.
      
      CC: Al Viro <viro@ZenIV.linux.org.uk>
      CC: Christoph Hellwig <hch@lst.de>
      CC: Ted Ts'o <tytso@mit.edu>
      CC: Joel Becker <joel.becker@oracle.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      f00c9e44
  9. 11 1月, 2011 1 次提交
  10. 28 10月, 2010 3 次提交
    • J
      quota: Fix possible oops in __dquot_initialize() · 4408ea41
      Jan Kara 提交于
      When quotaon(8) races with __dquot_initialize() or dqget() fails because
      of EIO, ENOSPC, or similar error, we could possibly dereference NULL pointer
      in inode->i_dquot[cnt]. Add proper checking.
      Reported-by: NDmitry Monakhov <dmonakhov@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      4408ea41
    • J
      quota: Fix issuing of warnings from dquot_transfer · 86f3cbec
      Jan Kara 提交于
      __dquot_transfer accidentally called flush_warnings for a wrong set of
      dquots which could result in quota warnings being issued with a wrong
      identification. Also when operation fails because of EDQUOT, there's no
      need check for issuing information message about user getting below limits
      (no transfer has actually happened).
      Signed-off-by: NJan Kara <jack@suse.cz>
      86f3cbec
    • D
      quota: fix dquot_disable vs dquot_transfer race v2 · 9e32784b
      Dmitry 提交于
      I've got following lockup:
      dquot_disable                              dquot_transfer
                                                  ->dqget()
      					       sb_has_quota_active
      dqopt->flags &= ~dquot_state_flag(f, cnt)      atomic_inc(dq->dq_count)
       ->drop_dquot_ref(sb, cnt);
          down_write(dqptr_sem)
          inode->i_dquot[cnt] = NULL              ->__dquot_transfer
      invalidate_dquots(sb, cnt);		       down_write(&dqptr_sem)
        ->wait for dq_wait_unused		       inode->i_dquot = new_dquot
        /* wait forever */                            ^^^^New quota user^^^^^^
      
      We cannot allow new references to dquots from inodes after drop_dquot_ref()
      has removed them.  We have to recheck quota state under dqptr_sem and before
      assignment, as we do it in dquot_initialize().
      Signed-off-by: NDmitry Monakhov <dmonakhov@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      9e32784b
  11. 10 8月, 2010 1 次提交
    • A
      simplify checks for I_CLEAR/I_FREEING · a4ffdde6
      Al Viro 提交于
      add I_CLEAR instead of replacing I_FREEING with it.  I_CLEAR is
      equivalent to I_FREEING for almost all code looking at either;
      it's there to keep track of having called clear_inode() exactly
      once per inode lifetime, at some point after having set I_FREEING.
      I_CLEAR and I_FREEING never get set at the same time with the
      current code, so we can switch to setting i_flags to I_FREEING | I_CLEAR
      instead of I_CLEAR without loss of information.  As the result of
      such change, checks become simpler and the amount of code that needs
      to know about I_CLEAR shrinks a lot.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a4ffdde6
  12. 23 7月, 2010 1 次提交
  13. 21 7月, 2010 4 次提交
  14. 19 7月, 2010 1 次提交
    • D
      mm: add context argument to shrinker callback · 7f8275d0
      Dave Chinner 提交于
      The current shrinker implementation requires the registered callback
      to have global state to work from. This makes it difficult to shrink
      caches that are not global (e.g. per-filesystem caches). Pass the shrinker
      structure to the callback so that users can embed the shrinker structure
      in the context the shrinker needs to operate on and get back to it in the
      callback via container_of().
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      7f8275d0
  15. 28 5月, 2010 1 次提交
  16. 27 5月, 2010 1 次提交
  17. 24 5月, 2010 4 次提交
  18. 22 5月, 2010 7 次提交
    • J
      quota: Refactor dquot_transfer code so that OCFS2 can pass in its references · bc8e5f07
      Jan Kara 提交于
      Currently, __dquot_transfer() acquires its own references of dquot structures
      that will be put into inode. But for OCFS2, this creates a lock inversion
      between dq_lock (waited on in dqget) and transaction start (started in
      ocfs2_setattr). Currently, deadlock is impossible because dq_lock is acquired
      only during dquot_acquire and dquot_release and we already hold a reference to
      dquot structures in ocfs2_setattr so neither of these functions can be called
      while we call dquot_transfer. But this is rather subtle and it is hard to teach
      lockdep about it. So provide __dquot_transfer function that can be passed dquot
      references directly. OCFS2 can then pass acquired dquot references directly to
      __dquot_transfer with proper locking.
      Signed-off-by: NJan Kara <jack@suse.cz>
      bc8e5f07
    • D
      quota: unify quota init condition in setattr · 12755627
      Dmitry Monakhov 提交于
      Quota must being initialized if size or uid/git changes requested.
      But initialization performed in two different places:
      in case of i_size file system is responsible for dquot init
      , but in case of uid/gid init will be called internally in
      dquot_transfer().
      This ambiguity makes code harder to understand.
      Let's move this logic to one common helper function.
      Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      12755627
    • C
      quota: unify ->set_dqblk · c472b432
      Christoph Hellwig 提交于
      Pass the larger struct fs_disk_quota to the ->set_dqblk operation so
      that the Q_SETQUOTA and Q_XSETQUOTA operations can be implemented
      with a single filesystem operation and we can retire the ->set_xquota
      operation.  The additional information (RT-subvolume accounting and
      warn counts) are left zero for the VFS quota implementation.
      
      Add new fieldmask values for setting the numer of blocks and inodes
      values which is required for the VFS quota, but wasn't for XFS.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      c472b432
    • C
      quota: unify ->get_dqblk · b9b2dd36
      Christoph Hellwig 提交于
      Pass the larger struct fs_disk_quota to the ->get_dqblk operation so
      that the Q_GETQUOTA and Q_XGETQUOTA operations can be implemented
      with a single filesystem operation and we can retire the ->get_xquota
      operation.  The additional information (RT-subvolume accounting and
      warn counts) are left zero for the VFS quota implementation.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      b9b2dd36
    • D
      quota: Make quota stat accounting lockless. · dde95888
      Dmitry Monakhov 提交于
      Quota stats is mostly writable data structure. Let's alloc percpu
      bucket for each value.
      
      NOTE: dqstats_read() function is racy against dqstats_{inc,dec}
      and may return inconsistent value. But this is ok since absolute
      accuracy is not required.
      Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      dde95888
    • S
      suppress warning: "quotatypes" defined but not used · da8d1ba2
      Sergey Senozhatsky 提交于
      Suppress compilation warning: "quotatypes" defined but not used.
      quotatypes is used only when CONFIG_QUOTA_DEBUG or CONFIG_PRINT_QUOTA_WARNING
      is/are defined.
      Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      da8d1ba2
    • D
      quota: optimize mark_dirty logic · eabf290d
      Dmitry Monakhov 提交于
      - Skip locking if quota is dirty already.
      - Return old quota state to help fs-specciffic implementation to optimize
        case where quota was dirty already.
      Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      eabf290d
  19. 16 5月, 2010 2 次提交
  20. 21 4月, 2010 1 次提交
    • J
      quota: Convert __DQUOT_PARANOIA symbol to standard config option · 62af9b52
      Jan Kara 提交于
      Make __DQUOT_PARANOIA define from the old days a standard config option
      and turn it off by default.
      
      This gets rid of a quota warning about writes before quota is turned on
      for systems with ext4 root filesystem. Currently there's no way to legally
      solve this because /etc/mtab has to be written before quota is turned on
      on most systems.
      Signed-off-by: NJan Kara <jack@suse.cz>
      62af9b52
  21. 13 4月, 2010 2 次提交
  22. 05 3月, 2010 2 次提交