1. 18 8月, 2017 6 次提交
  2. 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
  3. 25 5月, 2017 1 次提交
  4. 19 4月, 2017 2 次提交
  5. 02 3月, 2017 1 次提交
  6. 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
  7. 06 12月, 2016 1 次提交
  8. 30 11月, 2016 2 次提交
  9. 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
  10. 28 10月, 2016 3 次提交
    • J
      genetlink: mark families as __ro_after_init · 56989f6d
      Johannes Berg 提交于
      Now genl_register_family() is the only thing (other than the
      users themselves, perhaps, but I didn't find any doing that)
      writing to the family struct.
      
      In all families that I found, genl_register_family() is only
      called from __init functions (some indirectly, in which case
      I've add __init annotations to clarifly things), so all can
      actually be marked __ro_after_init.
      
      This protects the data structure from accidental corruption.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56989f6d
    • J
      genetlink: statically initialize families · 489111e5
      Johannes Berg 提交于
      Instead of providing macros/inline functions to initialize
      the families, make all users initialize them statically and
      get rid of the macros.
      
      This reduces the kernel code size by about 1.6k on x86-64
      (with allyesconfig).
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      489111e5
    • J
      genetlink: no longer support using static family IDs · a07ea4d9
      Johannes Berg 提交于
      Static family IDs have never really been used, the only
      use case was the workaround I introduced for those users
      that assumed their family ID was also their multicast
      group ID.
      
      Additionally, because static family IDs would never be
      reserved by the generic netlink code, using a relatively
      low ID would only work for built-in families that can be
      registered immediately after generic netlink is started,
      which is basically only the control family (apart from
      the workaround code, which I also had to add code for so
      it would reserve those IDs)
      
      Thus, anything other than GENL_ID_GENERATE is flawed and
      luckily not used except in the cases I mentioned. Move
      those workarounds into a few lines of code, and then get
      rid of GENL_ID_GENERATE entirely, making it more robust.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a07ea4d9
  11. 15 8月, 2016 1 次提交
    • E
      quota: fill in Q_XGETQSTAT inode information for inactive quotas · 3cd0126d
      Eric Sandeen 提交于
      The manpage for quotactl says that the Q_XGETQSTAT command is
      "useful in finding out how much space is spent to store quota
      information," but the current implementation does not report this
      info if the inode is allocated, but its quota type is not enabled.
      
      This is a change from the earlier XFS implementation, which
      reported information about allocated quota inodes even if their
      quota type was not currently active.
      
      Change quota_getstate() and quota_getstatev() to copy out the inode
      information if the filesystem has provided it, even if the quota
      type for that inode is not currently active.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NBill O'Donnell <billodo@redhat.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      3cd0126d
  12. 06 7月, 2016 3 次提交
  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. 27 4月, 2016 1 次提交
  15. 29 3月, 2016 1 次提交
  16. 14 3月, 2016 1 次提交
  17. 03 3月, 2016 1 次提交
  18. 18 2月, 2016 2 次提交
    • J
      quota: Forbid Q_GETQUOTA and Q_GETNEXTQUOTA for frozen filesystem · ccf370e4
      Jan Kara 提交于
      Commit 7955118e (quota: Allow Q_GETQUOTA for frozen filesystem)
      allowed Q_GETQUOTA call for frozen filesystem. It makes sense on the
      first look but zero-day testing has shown that with this change ext4
      warns about starting a transaction for frozen filesystem. This happens
      because ext4_acquire_dquot() prepares for allocating space for new quota
      structure. Although it would be possible to implement Q_GETQUOTA for
      ext4 without allocating space for non-existent structures, the matter
      further complicates because OCFS2 needs to update on-disk structure use
      count when a new cluster node loads quota information from disk. So just
      revert the change and forbid Q_GETQUOTA together with Q_GETNEXTQUOTA for
      frozen filesystem. Add comment to quotactl_cmd_write() to save us from
      repeating this excercise in a few years when I forget again.
      Signed-off-by: NJan Kara <jack@suse.cz>
      ccf370e4
    • 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
  19. 09 2月, 2016 4 次提交
  20. 08 2月, 2016 3 次提交
    • E
      quota: add new quotactl Q_GETNEXTQUOTA · 926132c0
      Eric Sandeen 提交于
      Q_GETNEXTQUOTA is exactly like Q_GETQUOTA, except that it
      will return quota information for the id equal to or greater
      than the id requested.  In other words, if the requested id has
      no quota, the command will return quota information for the
      next higher id which does have a quota set.  If no higher id
      has an active quota, -ESRCH is returned.
      
      This allows filesystems to do efficient iteration in kernelspace,
      much like extN filesystems do in userspace when asked to report
      all active quotas.
      
      This does require a new data structure for userspace, as the
      current structure does not include an ID for the returned quota
      information.
      
      Today, Ext4 with a hidden quota inode requires getpwent-style
      iterations, and for systems which have i.e. LDAP backends,
      this can be very slow, or even impossible if iteration is not
      allowed in the configuration.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      
      926132c0
    • E
      quota: add new quotactl Q_XGETNEXTQUOTA · 8b375249
      Eric Sandeen 提交于
      Q_XGETNEXTQUOTA is exactly like Q_XGETQUOTA, except that it
      will return quota information for the id equal to or greater
      than the id requested.  In other words, if the requested id has
      no quota, the command will return quota information for the
      next higher id which does have a quota set.  If no higher id
      has an active quota, -ESRCH is returned.
      
      This allows filesystems to do efficient iteration in kernelspace,
      much like extN filesystems do in userspace when asked to report
      all active quotas.
      
      The patch adds a d_id field to struct qc_dqblk so that we can
      pass back the id of the quota which was found, and return it
      to userspace.
      
      Today, filesystems such as XFS require getpwent-style iterations,
      and for systems which have i.e. LDAP backends, this can be very
      slow, or even impossible if iteration is not allowed in the
      configuration.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      8b375249
    • E
      quota: remove unused cmd argument from quota_quotaon() · 3218a3ec
      Eric Sandeen 提交于
      The cmd argument to quota_quotaon() via Q_QUOTAON quotactl
      is not used, so remove it.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      3218a3ec
  21. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  22. 04 1月, 2016 1 次提交