1. 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
  2. 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
  3. 29 3月, 2016 1 次提交
  4. 14 3月, 2016 1 次提交
  5. 03 3月, 2016 1 次提交
  6. 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
  7. 09 2月, 2016 1 次提交
  8. 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
  9. 14 12月, 2015 1 次提交
    • P
      fs: make quota/dquot.c explicitly non-modular · 331221fa
      Paul Gortmaker 提交于
      The Kconfig currently controlling compilation of this code is:
      
      config QUOTA
              bool "Quota support"
      
      ...meaning that it currently is not being built as a module by anyone.
      
      Lets remove the couple traces of modularity so that when reading the
      driver there is no doubt it is builtin-only.
      
      Since module_init translates to device_initcall in the non-modular
      case, the init ordering gets bumped to one level earlier when we
      use the more appropriate fs_initcall here.  However we've made similar
      changes before without any fallout and none is expected here either.
      
      We don't delete module.h because the code in turn tries to load other
      modules as appropriate and so it still needs that header.
      
      Cc: Jan Kara <jack@suse.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      331221fa
  10. 18 8月, 2015 1 次提交
  11. 24 7月, 2015 1 次提交
    • J
      quota: Propagate error from ->acquire_dquot() · 6184fc0b
      Jan Kara 提交于
      Currently when some error happened in ->acquire_dquot(), dqget() just
      returned NULL. That was indistinguishable from a case when e.g. someone
      run quotaoff and so was generally silently ignored. However
      ->acquire_dquot() can fail because of ENOSPC or EIO in which case user
      should better know. So propagate error up from ->acquire_dquot properly.
      Signed-off-by: NJan Kara <jack@suse.cz>
      6184fc0b
  12. 16 4月, 2015 1 次提交
  13. 19 3月, 2015 1 次提交
  14. 04 3月, 2015 3 次提交
  15. 30 1月, 2015 2 次提交
    • J
      quota: Store maximum space limit in bytes · b10a0819
      Jan Kara 提交于
      Currently maximum space limit quota format supports is in blocks however
      since we store space limits in bytes, this is somewhat confusing. So
      store the maximum limit in bytes as well. Also rename the field to match
      the new unit and related inode field to match the new naming scheme.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      b10a0819
    • J
      quota: Add ->quota_{enable,disable} callbacks for VFS quotas · 3e2af67e
      Jan Kara 提交于
      Add functions which translate ->quota_enable / ->quota_disable calls
      into appropriate changes in VFS quota. This will enable filesystems
      supporting VFS quota files in system inodes to be controlled via
      Q_XQUOTA[ON|OFF] quotactls for better userspace compatibility.
      
      Also provide a vector for quotactl using these functions which can be
      used by filesystems with quota files stored in hidden system files.
      Signed-off-by: NJan Kara <jack@suse.cz>
      3e2af67e
  16. 28 1月, 2015 1 次提交
    • J
      quota: Switch ->get_dqblk() and ->set_dqblk() to use bytes as space units · 14bf61ff
      Jan Kara 提交于
      Currently ->get_dqblk() and ->set_dqblk() use struct fs_disk_quota which
      tracks space limits and usage in 512-byte blocks. However VFS quotas
      track usage in bytes (as some filesystems require that) and we need to
      somehow pass this information. Upto now it wasn't a problem because we
      didn't do any unit conversion (thus VFS quota routines happily stuck
      number of bytes into d_bcount field of struct fd_disk_quota). Only if
      you tried to use Q_XGETQUOTA or Q_XSETQLIM for VFS quotas (or Q_GETQUOTA
      / Q_SETQUOTA for XFS quotas), you got bogus results. Hardly anyone
      tried this but reportedly some Samba users hit the problem in practice.
      So when we want interfaces compatible we need to fix this.
      
      We bite the bullet and define another quota structure used for passing
      information from/to ->get_dqblk()/->set_dqblk. It's somewhat sad we have
      to have more conversion routines in fs/quota/quota.c and another copying
      of quota structure slows down getting of quota information by about 2%
      but it seems cleaner than overloading e.g. units of d_bcount to bytes.
      
      CC: stable@vger.kernel.org
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      14bf61ff
  17. 22 1月, 2015 2 次提交
    • J
      quota: Verify flags passed to Q_SETINFO · ca6cb091
      Jan Kara 提交于
      Currently flags passed via Q_SETINFO were just stored. This makes it
      hard to add new flags since in theory userspace could be just setting /
      clearing random flags. Since currently there is only one userspace
      settable flag and that is somewhat obscure flags only for ancient v1
      quota format, I'm reasonably sure noone operates these flags and
      hopefully we are fine just adding the check that passed flags are sane.
      If we indeed find some userspace program that gets broken by the strict
      check, we can always remove it again.
      Signed-off-by: NJan Kara <jack@suse.cz>
      ca6cb091
    • J
      quota: Cleanup flags definitions · 9c45101e
      Jan Kara 提交于
      Currently all quota flags were defined just in kernel-private headers.
      Export flags readable / writeable from userspace to userspace via
      include/uapi/linux/quota.h.
      Signed-off-by: NJan Kara <jack@suse.cz>
      9c45101e
  18. 10 11月, 2014 3 次提交
  19. 04 11月, 2014 1 次提交
  20. 22 10月, 2014 1 次提交
  21. 08 9月, 2014 1 次提交
    • T
      percpu_counter: add @gfp to percpu_counter_init() · 908c7f19
      Tejun Heo 提交于
      Percpu allocator now supports allocation mask.  Add @gfp to
      percpu_counter_init() so that !GFP_KERNEL allocation masks can be used
      with percpu_counters too.
      
      We could have left percpu_counter_init() alone and added
      percpu_counter_init_gfp(); however, the number of users isn't that
      high and introducing _gfp variants to all percpu data structures would
      be quite ugly, so let's just do the conversion.  This is the one with
      the most users.  Other percpu data structures are a lot easier to
      convert.
      
      This patch doesn't make any functional difference.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJan Kara <jack@suse.cz>
      Acked-by: N"David S. Miller" <davem@davemloft.net>
      Cc: x86@kernel.org
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      908c7f19
  22. 16 7月, 2014 4 次提交
  23. 04 4月, 2014 1 次提交
  24. 21 2月, 2014 1 次提交
    • J
      quota: Fix race between dqput() and dquot_scan_active() · 1362f4ea
      Jan Kara 提交于
      Currently last dqput() can race with dquot_scan_active() causing it to
      call callback for an already deactivated dquot. The race is as follows:
      
      CPU1					CPU2
        dqput()
          spin_lock(&dq_list_lock);
          if (atomic_read(&dquot->dq_count) > 1) {
           - not taken
          if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
            spin_unlock(&dq_list_lock);
            ->release_dquot(dquot);
              if (atomic_read(&dquot->dq_count) > 1)
               - not taken
      					  dquot_scan_active()
      					    spin_lock(&dq_list_lock);
      					    if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
      					     - not taken
      					    atomic_inc(&dquot->dq_count);
      					    spin_unlock(&dq_list_lock);
              - proceeds to release dquot
      					    ret = fn(dquot, priv);
      					     - called for inactive dquot
      
      Fix the problem by making sure possible ->release_dquot() is finished by
      the time we call the callback and new calls to it will notice reference
      dquot_scan_active() has taken and bail out.
      
      CC: stable@vger.kernel.org # >= 2.6.29
      Signed-off-by: NJan Kara <jack@suse.cz>
      1362f4ea
  25. 11 9月, 2013 2 次提交
    • D
      fs: convert fs shrinkers to new scan/count API · 1ab6c499
      Dave Chinner 提交于
      Convert the filesystem shrinkers to use the new API, and standardise some
      of the behaviours of the shrinkers at the same time.  For example,
      nr_to_scan means the number of objects to scan, not the number of objects
      to free.
      
      I refactored the CIFS idmap shrinker a little - it really needs to be
      broken up into a shrinker per tree and keep an item count with the tree
      root so that we don't need to walk the tree every time the shrinker needs
      to count the number of objects in the tree (i.e.  all the time under
      memory pressure).
      
      [glommer@openvz.org: fixes for ext4, ubifs, nfs, cifs and glock. Fixes are needed mainly due to new code merged in the tree]
      [assorted fixes folded in]
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NGlauber Costa <glommer@openvz.org>
      Acked-by: NMel Gorman <mgorman@suse.de>
      Acked-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Acked-by: NJan Kara <jack@suse.cz>
      Acked-by: NSteven Whitehouse <swhiteho@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Carlos Maiolino <cmaiolino@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: J. Bruce Fields <bfields@redhat.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      1ab6c499
    • G
      super: fix calculation of shrinkable objects for small numbers · 55f841ce
      Glauber Costa 提交于
      The sysctl knob sysctl_vfs_cache_pressure is used to determine which
      percentage of the shrinkable objects in our cache we should actively try
      to shrink.
      
      It works great in situations in which we have many objects (at least more
      than 100), because the aproximation errors will be negligible.  But if
      this is not the case, specially when total_objects < 100, we may end up
      concluding that we have no objects at all (total / 100 = 0, if total <
      100).
      
      This is certainly not the biggest killer in the world, but may matter in
      very low kernel memory situations.
      Signed-off-by: NGlauber Costa <glommer@openvz.org>
      Reviewed-by: NCarlos Maiolino <cmaiolino@redhat.com>
      Acked-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: NMel Gorman <mgorman@suse.de>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Carlos Maiolino <cmaiolino@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: J. Bruce Fields <bfields@redhat.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      55f841ce
  26. 17 8月, 2013 1 次提交
  27. 05 7月, 2013 1 次提交
  28. 12 3月, 2013 1 次提交
  29. 10 10月, 2012 1 次提交