1. 11 1月, 2010 1 次提交
    • J
      quota: Fix dquot_transfer for filesystems different from ext4 · 05b5d898
      Jan Kara 提交于
      Commit fd8fbfc1 modified the way we find amount of reserved space
      belonging to an inode. The amount of reserved space is checked
      from dquot_transfer and thus inode_reserved_space gets called
      even for filesystems that don't provide get_reserved_space callback
      which results in a BUG.
      
      Fix the problem by checking get_reserved_space callback and return 0 if
      the filesystem does not provide it.
      
      CC: Dmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      05b5d898
  2. 23 12月, 2009 2 次提交
    • D
      quota: Move duplicated code to separate functions · dc52dd3a
      Dmitry Monakhov 提交于
      - for(..) { mark_dquot_dirty(); } -> mark_all_dquot_dirty()
      - for(..) { dput(); }             -> dqput_all()
      Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      dc52dd3a
    • D
      quota: decouple fs reserved space from quota reservation · fd8fbfc1
      Dmitry Monakhov 提交于
      Currently inode_reservation is managed by fs itself and this
      reservation is transfered on dquot_transfer(). This means what
      inode_reservation must always be in sync with
      dquot->dq_dqb.dqb_rsvspace. Otherwise dquot_transfer() will result
      in incorrect quota(WARN_ON in dquot_claim_reserved_space() will be
      triggered)
      This is not easy because of complex locking order issues
      for example http://bugzilla.kernel.org/show_bug.cgi?id=14739
      
      The patch introduce quota reservation field for each fs-inode
      (fs specific inode is used in order to prevent bloating generic
      vfs inode). This reservation is managed by quota code internally
      similar to i_blocks/i_bytes and may not be always in sync with
      internal fs reservation.
      
      Also perform some code rearrangement:
      - Unify dquot_reserve_space() and dquot_reserve_space()
      - Unify dquot_release_reserved_space() and dquot_free_space()
      - Also this patch add missing warning update to release_rsv()
        dquot_release_reserved_space() must call flush_warnings() as
        dquot_free_space() does.
      Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      fd8fbfc1
  3. 10 12月, 2009 1 次提交
    • J
      quota: Fix WARN_ON in lookup_one_len · c56818d7
      Jan Kara 提交于
      We should hold i_mutex when looking up quota files for journaled quotas,
      otherwise a WARN_ON in lookup_one_len triggers. The fact that we didn't
      hold i_mutex previously probably could not lead to a real bug since the
      filesystem is just being mounted / remounted read-write and thus the
      root directory cannot change anyway but it's definitely cleaner with
      i_mutex.
      Reported-by: NBastien ROUCARIES <roucaries.bastien@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      c56818d7
  4. 03 12月, 2009 1 次提交
    • S
      VFS: Export dquot_send_warning · 86e931a3
      Steven Whitehouse 提交于
      Sending a message to userspace in a generic format to warn
      of events (e.g. quota exceeded) in the quota subsystem is
      a generically useful feature. This patch makes some minor
      changes to the send_message function from dquot.c renaming
      it quota_send_message, moving it to quota.c and exporting it
      for use by filesystems which do not use the dquot code.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      86e931a3
  5. 19 11月, 2009 1 次提交
  6. 12 11月, 2009 1 次提交
  7. 22 9月, 2009 2 次提交
  8. 30 7月, 2009 1 次提交
  9. 08 7月, 2009 1 次提交
    • J
      quota: Fix possible deadlock during parallel quotaon and quotaoff · d01730d7
      Jiaying Zhang 提交于
      The following test script triggers a deadlock on ext2 filesystem:
      while true; do quotaon /dev/hda >&/dev/null; usleep $RANDOM; done &
      while true; do quotaoff /dev/hda >&/dev/null; usleep $RANDOM; done &
      
      I found there is a potential deadlock between quotaon and quotaoff (or
      quotasync). Basically, all of quotactl operations need to be protected by
      dqonoff_mutex. vfs_quota_off and vfs_quota_sync also call sb->s_op->quota_write
      that needs to grab the i_mutex of the quota file.  But in vfs_quota_on_inode
      (called from quotaon operation), the current code tries to grab  the i_mutex of
      the quota file first before getting quonoff_mutex.
      
      Reverse the order in which we take locks in vfs_quota_on_inode().
      
      Jan Kara: Changed changelog to be more readable, made lockdep happy with
        I_MUTEX_QUOTA.
      Signed-off-by: NJiaying Zhang <jiayingz@google.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      d01730d7
  10. 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
  11. 26 3月, 2009 8 次提交
  12. 06 2月, 2009 1 次提交
    • P
      netlink: change return-value logic of netlink_broadcast() · ff491a73
      Pablo Neira Ayuso 提交于
      Currently, netlink_broadcast() reports errors to the caller if no
      messages at all were delivered:
      
      1) If, at least, one message has been delivered correctly, returns 0.
      2) Otherwise, if no messages at all were delivered due to skb_clone()
         failure, return -ENOBUFS.
      3) Otherwise, if there are no listeners, return -ESRCH.
      
      With this patch, the caller knows if the delivery of any of the
      messages to the listeners have failed:
      
      1) If it fails to deliver any message (for whatever reason), return
         -ENOBUFS.
      2) Otherwise, if all messages were delivered OK, returns 0.
      3) Otherwise, if no listeners, return -ESRCH.
      
      In the current ctnetlink code and in Netfilter in general, we can add
      reliable logging and connection tracking event delivery by dropping the
      packets whose events were not successfully delivered over Netlink. Of
      course, this option would be settable via /proc as this approach reduces
      performance (in terms of filtered connections per seconds by a stateful
      firewall) but providing reliable logging and event delivery (for
      conntrackd) in return.
      
      This patch also changes some clients of netlink_broadcast() that
      may report ENOBUFS errors via printk. This error handling is not
      of any help. Instead, the userspace daemons that are listening to
      those netlink messages should resync themselves with the kernel-side
      if they hit ENOBUFS.
      
      BTW, netlink_broadcast() clients include those that call
      cn_netlink_send(), nlmsg_multicast() and genlmsg_multicast() since they
      internally call netlink_broadcast() and return its error value.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ff491a73
  13. 17 1月, 2009 1 次提交
    • J
      quota: Improve locking · cc33412f
      Jan Kara 提交于
      We implement dqget() and dqput() that need neither dqonoff_mutex nor dqptr_sem.
      Then move dqget() and dqput() calls so that they are not called from under
      dqptr_sem. This is important because filesystem callbacks aren't called from
      under dqptr_sem which used to cause *lots* of problems with lock ranking
      (and with OCFS2 they became close to unsolvable).
      
      The patch also removes two functions which were introduced solely because OCFS2
      needed them to cope with the old locking scheme. As time showed, they were not
      enough for OCFS2 anyway and it would be unnecessary work to adapt them to the
      new locking scheme in which they aren't needed.  As a result OCFS2 needs the
      following patch to compile properly with quotas.  Sorry to any bisecters which
      hit this in advance.
      Signed-off-by: NJan Kara <jack@suse.cz>
      cc33412f
  14. 09 1月, 2009 1 次提交
  15. 06 1月, 2009 11 次提交
  16. 14 11月, 2008 1 次提交
  17. 23 10月, 2008 1 次提交
  18. 17 10月, 2008 1 次提交
  19. 14 10月, 2008 2 次提交
  20. 01 8月, 2008 1 次提交
    • A
      [PATCH] fix races and leaks in vfs_quota_on() users · 77e69dac
      Al Viro 提交于
      * new helper: vfs_quota_on_path(); equivalent of vfs_quota_on() sans the
        pathname resolution.
      * callers of vfs_quota_on() that do their own pathname resolution and
        checks based on it are switched to vfs_quota_on_path(); that way we
        avoid the races.
      * reiserfs leaked dentry/vfsmount references on several failure exits.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      77e69dac