1. 22 5月, 2010 3 次提交
    • J
      ocfs2: Fix quota locking · fb8dd8d7
      Jan Kara 提交于
      OCFS2 had three issues with quota locking:
      a) When reading dquot from global quota file, we started a transaction while
         holding dqio_mutex which is prone to deadlocks because other paths do it
         the other way around
      b) During ocfs2_sync_dquot we were not protected against concurrent writers
         on the same node. Because we first copy data to local buffer, a race
         could happen resulting in old data being written to global quota file and
         thus causing quota inconsistency after a crash.
      c) ip_alloc_sem of quota files was acquired while a transaction is started
         in ocfs2_quota_write which can deadlock because we first get ip_alloc_sem
         and then start a transaction when extending quota files.
      
      We fix the problem a) by pulling all necessary code to ocfs2_acquire_dquot
      and ocfs2_release_dquot. Thus we no longer depend on generic dquot_acquire
      to do the locking and can force proper lock ordering.
      
      Problems b) and c) are fixed by locking i_mutex and ip_alloc_sem of
      global quota file in ocfs2_lock_global_qf and removing ip_alloc_sem from
      ocfs2_quota_read and ocfs2_quota_write.
      Acked-by: NJoel Becker <Joel.Becker@oracle.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      fb8dd8d7
    • J
      ocfs2: Avoid unnecessary block mapping when refreshing quota info · ae4f6ef1
      Jan Kara 提交于
      The position of global quota file info does not change. So we do not have
      to do logical -> physical block translation every time we reread it from
      disk. Thus we can also avoid taking ip_alloc_sem.
      Acked-by: NJoel Becker <Joel.Becker@oracle.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      ae4f6ef1
    • J
      ocfs2: Do not map blocks from local quota file on each write · f64dd44e
      Jan Kara 提交于
      There is no need to map offset of local dquot structure to on disk block
      in each quota write. It is enough to map it just once and store the physical
      block number in quota structure in memory. Moreover this simplifies locking
      as we do not have to take ip_alloc_sem from quota write path.
      Acked-by: NJoel Becker <Joel.Becker@oracle.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      f64dd44e
  2. 10 12月, 2009 1 次提交
  3. 22 9月, 2009 1 次提交
  4. 24 7月, 2009 1 次提交
  5. 06 1月, 2009 4 次提交
    • J
      ocfs2: Fix ocfs2_read_quota_block() error handling. · 85eb8b73
      Joel Becker 提交于
      ocfs2_bread() has become ocfs2_read_virt_blocks(), with a prototype to
      match ocfs2_read_blocks().  The quota code, converting from
      ocfs2_bread(), wraps the call to ocfs2_read_virt_blocks() in
      ocfs2_read_quota_block().  Unfortunately, the prototype of
      ocfs2_read_quota_block() matches the old prototype of ocfs2_bread().
      
      The problem is that ocfs2_bread() returned the buffer head, and callers
      assumed that a NULL pointer was indicative of error.  It wasn't.  This
      is why ocfs2_bread() took an int*err argument as well.
      
      The new prototype of ocfs2_read_virt_blocks() avoids this error handling
      confusion.  Let's change ocfs2_read_quota_block() to match.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      Acked-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      85eb8b73
    • J
      ocfs2: Implement quota recovery · 2205363d
      Jan Kara 提交于
      Implement functions for recovery after a crash. Functions just
      read local quota file and sync info to global quota file.
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      2205363d
    • M
      ocfs2: Periodic quota syncing · 171bf93c
      Mark Fasheh 提交于
      This patch creates a work queue for periodic syncing of locally cached quota
      information to the global quota files. We constantly queue a delayed work
      item, to get the periodic behavior.
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      Acked-by: NJan Kara <jack@suse.cz>
      171bf93c
    • J
      ocfs2: Implementation of local and global quota file handling · 9e33d69f
      Jan Kara 提交于
      For each quota type each node has local quota file. In this file it stores
      changes users have made to disk usage via this node. Once in a while this
      information is synced to global file (and thus with other nodes) so that
      limits enforcement at least aproximately works.
      
      Global quota files contain all the information about usage and limits. It's
      mostly handled by the generic VFS code (which implements a trie of structures
      inside a quota file). We only have to provide functions to convert structures
      from on-disk format to in-memory one. We also have to provide wrappers for
      various quota functions starting transactions and acquiring necessary cluster
      locks before the actual IO is really started.
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      9e33d69f