1. 18 9月, 2017 1 次提交
  2. 18 8月, 2017 20 次提交
  3. 07 8月, 2017 1 次提交
    • Z
      quota: correct space limit check · 41e327b5
      zhangyi (F) 提交于
      Currently we compare total space (curspace + rsvspace)
      with space limit in quota-tools when setting grace time
      and also in check_bdq(), but we missing rsvspace in
      somewhere else, correct them. This patch also fix incorrect
      zero dqb_btime and grace time updating failure when we use
      rsvspace(e.g. ext4 dalloc feature).
      Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      41e327b5
  4. 22 6月, 2017 1 次提交
    • T
      quota: add get_inode_usage callback to transfer multi-inode charges · 7a9ca53a
      Tahsin Erdogan 提交于
      Ext4 ea_inode feature allows storing xattr values in external inodes to
      be able to store values that are bigger than a block in size. Ext4 also
      has deduplication support for these type of inodes. With deduplication,
      the actual storage waste is eliminated but the users of such inodes are
      still charged full quota for the inodes as if there was no sharing
      happening in the background.
      
      This design requires ext4 to manually charge the users because the
      inodes are shared.
      
      An implication of this is that, if someone calls chown on a file that
      has such references we need to transfer the quota for the file and xattr
      inodes. Current dquot_transfer() function implicitly transfers one inode
      charge. With ea_inode feature, we would like to transfer multiple inode
      charges.
      
      Add get_inode_usage callback which can interrogate the total number of
      inodes that were charged for a given inode.
      
      [ Applied fix from Colin King to make sure the 'ret' variable is
        initialized on the successful return path.  Detected by
        CoverityScan, CID#1446616 ("Uninitialized scalar variable") --tytso]
      Signed-off-by: NTahsin Erdogan <tahsin@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Acked-by: NJan Kara <jack@suse.cz>
      7a9ca53a
  5. 25 5月, 2017 1 次提交
  6. 19 4月, 2017 2 次提交
  7. 02 3月, 2017 1 次提交
  8. 19 12月, 2016 1 次提交
    • J
      quota: Fix bogus warning in dquot_disable() · 2700e606
      Jan Kara 提交于
      dquot_disable() was warning when sb_has_quota_loaded() was true when
      invalidating page cache for quota files. The thinking behind this
      warning was that we must have raced with somebody else turning quotas on
      and this should not happen because all places modifying quota state must
      hold s_umount exclusively now. However sb_has_quota_loaded() can be also
      true at this point when we are just suspending quotas on remount
      read-only. Just restore the behavior to situation before commit
      c3b00446 ("quota: Remove dqonoff_mutex") which introduced the
      warning.
      
      The code in dquot_disable() can be further simplified with the new
      locking of quota state changes however let's leave that to a separate
      commit that can get more testing exposure.
      
      Fixes: c3b00446Signed-off-by: NJan Kara <jack@suse.cz>
      2700e606
  9. 06 12月, 2016 1 次提交
  10. 30 11月, 2016 2 次提交
  11. 24 11月, 2016 2 次提交
    • J
      quota: Use s_umount protection for quota operations · 9d1ccbe7
      Jan Kara 提交于
      Writeback quota is protected by s_umount semaphore held for reading
      because every writeback must be protected by that lock (grabbed either
      by the generic writeback code or by quotactl handler). Getting next
      available ID in quota file, querying quota state, setting quota
      information, getting quota format are all quotactl operations protected
      by s_umount semaphore held for reading grabbed in quotactl handler.
      
      This also fixes lockdep splat about possible deadlock during filesystem
      freezing where sync_filesystem() is called with page-faults already
      blocked but sync_filesystem() calls into dquot_writeback_dquots() which
      grabs dqonoff_mutex which ranks above i_mutex (vfs_load_quota_inode()
      grabs i_mutex under dqonoff_mutex) which clearly ranks below page fault
      freeze protection (e.g. via mmap_sem dependencies). The reported problem
      is not a real deadlock possibility since during quota on we check
      whether filesystem freezing is not in progress but still it is good to
      have this fixed.
      Reported-by: NTed Tso <tytso@mit.edu>
      Reported-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      9d1ccbe7
    • J
      quota: Hold s_umount in exclusive mode when enabling / disabling quotas · 7d6cd73d
      Jan Kara 提交于
      Currently we hold s_umount semaphore only in shared mode when enabling
      or disabling quotas and use dqonoff_mutex for serializing quota state
      changes on a filesystem and also quota state changes with other places
      depending on current quota state. Using dedicated mutex for this causes
      possible deadlocks during filesystem freezing (see following commit for
      details) so we transition to using s_umount semaphore for the necessary
      synchronization whose lock ordering is properly handled by the
      filesystem freezing code. As a start grab s_umount in exclusive mode
      when enabling / disabling quotas.
      Signed-off-by: NJan Kara <jack@suse.cz>
      7d6cd73d
  12. 06 7月, 2016 2 次提交
    • E
      dquot: For now explicitly don't support filesystems outside of init_user_ns · 5c004828
      Eric W. Biederman 提交于
      Mostly supporting filesystems outside of init_user_ns is
      s/&init_usre_ns/dquot->dq_sb->s_user_ns/.  An actual need for
      supporting quotas on filesystems outside of s_user_ns is quite a ways
      away and to be done responsibily needs an audit on what can happen
      with hostile quota files.  Until that audit is complete don't attempt
      to support quota files on filesystems outside of s_user_ns.
      
      Cc: Jan Kara <jack@suse.cz>
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      5c004828
    • E
      quota: Ensure qids map to the filesystem · d49d3762
      Eric W. Biederman 提交于
      Introduce the helper qid_has_mapping and use it to ensure that the
      quota system only considers qids that map to the filesystems
      s_user_ns.
      
      In practice for quota supporting filesystems today this is the exact
      same check as qid_valid.  As only 0xffffffff aka (qid_t)-1 does not
      map into init_user_ns.
      
      Replace the qid_valid calls with qid_has_mapping as values come in
      from userspace.  This is harmless today and it prepares the quota
      system to work on filesystems with quotas but mounted by unprivileged
      users.
      
      Call qid_has_mapping from dqget.  This ensures the passed in qid has a
      prepresentation on the underlying filesystem.  Previously this was
      unnecessary as filesystesm never had qids that could not map.  With
      the introduction of filesystems outside of s_user_ns this will not
      remain true.
      
      All of this ensures the quota code never has to deal with qids that
      don't map to the underlying filesystem.
      
      Cc: Jan Kara <jack@suse.cz>
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      d49d3762
  13. 20 6月, 2016 1 次提交
    • A
      quota: use time64_t internally · e008bb61
      Arnd Bergmann 提交于
      The quota subsystem has two formats, the old v1 format using architecture
      specific time_t values on the on-disk format, while the v2 format
      (introduced in Linux 2.5.16 and 2.4.22) uses fixed 64-bit little-endian.
      
      While there is no future for the v1 format beyond y2038, the v2 format
      is almost there on 32-bit architectures, as both the user interface
      and the on-disk format use 64-bit timestamps, just not the time_t
      inbetween.
      
      This changes the internal representation to use time64_t, which will
      end up doing the right thing everywhere for v2 format.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      e008bb61
  14. 29 3月, 2016 1 次提交
  15. 14 3月, 2016 1 次提交
  16. 03 3月, 2016 1 次提交
  17. 18 2月, 2016 1 次提交
    • J
      quota: Fix possible races during quota loading · 044c9b67
      Jan Kara 提交于
      When loading new quota structure from disk, there is a possibility caller
      of dqget() will see uninitialized data due to CPU reordering loads or
      stores - loads from dquot can be reordered before test of DQ_ACTIVE_B
      bit or setting of this bit could be reordered before filling of the
      structure. Fix the issue by adding proper memory barriers.
      Signed-off-by: NJan Kara <jack@suse.cz>
      044c9b67