1. 22 10月, 2014 1 次提交
  2. 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
  3. 16 7月, 2014 6 次提交
  4. 05 5月, 2014 1 次提交
    • E
      xfs: fix Q_XQUOTARM ioctl · 9da93f9b
      Eric Sandeen 提交于
      The Q_XQUOTARM quotactl was not working properly, because
      we weren't passing around proper flags.  The xfs_fs_set_xstate()
      ioctl handler used the same flags for Q_XQUOTAON/OFF as
      well as for Q_XQUOTARM, but Q_XQUOTAON/OFF look for
      XFS_UQUOTA_ACCT, XFS_UQUOTA_ENFD, XFS_GQUOTA_ACCT etc,
      i.e. quota type + state, while Q_XQUOTARM looks only for
      the type of quota, i.e. XFS_DQ_USER, XFS_DQ_GROUP etc.
      
      Unfortunately these flag spaces overlap a bit, so we
      got semi-random results for Q_XQUOTARM; i.e. the value
      for XFS_DQ_USER == XFS_UQUOTA_ACCT, etc.  yeargh.
      
      Add a new quotactl op vector specifically for the QUOTARM
      operation, since it operates with a different flag space.
      
      This has been broken more or less forever, AFAICT.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Acked-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      
      9da93f9b
  5. 04 4月, 2014 1 次提交
  6. 04 3月, 2014 1 次提交
  7. 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
  8. 20 11月, 2013 3 次提交
  9. 04 11月, 2013 1 次提交
  10. 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
  11. 21 8月, 2013 1 次提交
    • C
      quota: Add a new quotactl command Q_XGETQSTATV · af30cb44
      Chandra Seetharaman 提交于
      XFS now supports three types of quotas (user, group and project).
      
      Current version of Q_XGETSTAT has support for only two types of quotas.
      In order to support three types of quotas, the interface, specifically
      struct fs_quota_stat, need to be expanded. Current version of fs_quota_stat
      does not allow expansion without breaking backward compatibility.
      
      So, a quotactl command and new fs_quota_stat structure need to be added.
      
      This patch adds a new command Q_XGETQSTATV to quotactl() which takes
      a new data structure fs_quota_statv. This new data structure provides
      support for future expansion and backward compatibility.
      
      Callers of the new quotactl command have to set the version of the data
      structure being passed, and kernel will fill as much data as requested.
      If the kernel does not support the user-space provided version, EINVAL
      will be returned. User-space can reduce the version number and call the same
      quotactl again.
      Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NRich Johnston <rjohnston@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      
      [v2: Applied rjohnston's suggestions as per Chandra's request. -bpm]
      af30cb44
  12. 17 8月, 2013 1 次提交
  13. 05 7月, 2013 1 次提交
  14. 12 3月, 2013 1 次提交
  15. 13 12月, 2012 1 次提交
  16. 13 10月, 2012 1 次提交
    • J
      vfs: define struct filename and have getname() return it · 91a27b2a
      Jeff Layton 提交于
      getname() is intended to copy pathname strings from userspace into a
      kernel buffer. The result is just a string in kernel space. It would
      however be quite helpful to be able to attach some ancillary info to
      the string.
      
      For instance, we could attach some audit-related info to reduce the
      amount of audit-related processing needed. When auditing is enabled,
      we could also call getname() on the string more than once and not
      need to recopy it from userspace.
      
      This patchset converts the getname()/putname() interfaces to return
      a struct instead of a string. For now, the struct just tracks the
      string in kernel space and the original userland pointer for it.
      
      Later, we'll add other information to the struct as it becomes
      convenient.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      91a27b2a
  17. 10 10月, 2012 1 次提交
  18. 18 9月, 2012 7 次提交
    • E
      userns: Convert quota · 1a06d420
      Eric W. Biederman 提交于
      Now that the type changes are done, here is the final set of
      changes to make the quota code work when user namespaces are enabled.
      
      Small cleanups and fixes to make the code build when user namespaces
      are enabled.
      
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      1a06d420
    • E
      userns: Convert struct dquot_warn · 7b9c7321
      Eric W. Biederman 提交于
      Convert w_dq_id to be a struct kquid and remove the now unncessary
      w_dq_type.
      
      This is a simple conversion and enough other places have already
      been converted that this actually reduces the code complexity
      by a little bit, when removing now unnecessary type conversions.
      
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      7b9c7321
    • E
      userns: Convert struct dquot dq_id to be a struct kqid · 4c376dca
      Eric W. Biederman 提交于
      Change struct dquot dq_id to a struct kqid and remove the now
      unecessary dq_type.
      
      Make minimal changes to dquot, quota_tree, quota_v1, quota_v2, ext3,
      ext4, and ocfs2 to deal with the change in quota structures and
      signatures.  The ocfs2 changes are larger than most because of the
      extensive tracing throughout the ocfs2 quota code that prints out
      dq_id.
      
      quota_tree.c:get_index is modified to take a struct kqid instead of a
      qid_t because all of it's callers pass in dquot->dq_id and it allows
      me to introduce only a single conversion.
      
      The rest of the changes are either just replacing dq_type with dq_id.type,
      adding conversions to deal with the change in type and occassionally
      adding qid_eq to allow quota id comparisons in a user namespace safe way.
      
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Theodore Tso <tytso@mit.edu>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      4c376dca
    • E
      userns: Modify dqget to take struct kqid · aca645a6
      Eric W. Biederman 提交于
      Modify dqget to take struct kqid instead of a type and an identifier
      pair.
      
      Modify the callers of dqget in ocfs2 and dquot to take generate
      a struct kqid so they can continue to call dqget.  The conversion
      to create struct kqid should all be the final conversions that
      are needed in those code paths.
      
      Cc: Jan Kara <jack@suse.cz>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      aca645a6
    • E
      userns: Convert quota netlink aka quota_send_warning · 431f1974
      Eric W. Biederman 提交于
      Modify quota_send_warning to take struct kqid instead a type and
      identifier pair.
      
      When sending netlink broadcasts always convert uids and quota
      identifiers into the intial user namespace.  There is as yet no way to
      send a netlink broadcast message with different contents to receivers
      in different namespaces, so for the time being just map all of the
      identifiers into the initial user namespace which preserves the
      current behavior.
      
      Change the callers of quota_send_warning in gfs2, xfs and dquot
      to generate a struct kqid to pass to quota send warning.  When
      all of the user namespaces convesions are complete a struct kqid
      values will be availbe without need for conversion, but a conversion
      is needed now to avoid needing to convert everything at once.
      
      Cc: Ben Myers <bpm@sgi.com>
      Cc: Alex Elder <elder@kernel.org>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      431f1974
    • E
      userns: Convert qutoactl · 74a8a103
      Eric W. Biederman 提交于
      Update the quotactl user space interface to successfull compile with
      user namespaces support enabled and to hand off quota identifiers to
      lower layers of the kernel in struct kqid instead of type and qid
      pairs.
      
      The quota on function is not converted because while it takes a quota
      type and an id.  The id is the on disk quota format to use, which
      is something completely different.
      
      The signature of two struct quotactl_ops methods were changed to take
      struct kqid argumetns get_dqblk and set_dqblk.
      
      The dquot, xfs, and ocfs2 implementations of get_dqblk and set_dqblk
      are minimally changed so that the code continues to work with
      the change in parameter type.
      
      This is the first in a series of changes to always store quota
      identifiers in the kernel in struct kqid and only use raw type and qid
      values when interacting with on disk structures or userspace.  Always
      using struct kqid internally makes it hard to miss places that need
      conversion to or from the kernel internal values.
      
      Cc: Jan Kara <jack@suse.cz>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Ben Myers <bpm@sgi.com>
      Cc: Alex Elder <elder@kernel.org>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      74a8a103
    • E
      userns: Implement struct kqid · e8a3e471
      Eric W. Biederman 提交于
      Add the data type struct kqid which holds the kernel internal form of
      the owning identifier of a quota.  struct kqid is a replacement for
      the implicit union of uid, gid and project id stored in an unsigned
      int and the quota type field that is was used in the quota data
      structures.  Making the data type explicit allows the kuid_t and
      kgid_t type safety to propogate more thoroughly through the code,
      revealing more places where uid/gid conversions need be made.
      
      Along with the data type struct kqid comes the helper functions
      qid_eq, qid_lt, from_kqid, from_kqid_munged, qid_valid, make_kqid,
      make_kqid_invalid, make_kqid_uid, make_kqid_gid.
      
      Cc: Jan Kara <jack@suse.cz>
      Cc: Dave Chinner <david@fromorbit.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      e8a3e471
  19. 15 8月, 2012 1 次提交
  20. 23 7月, 2012 1 次提交
  21. 09 7月, 2012 1 次提交
  22. 16 5月, 2012 3 次提交
  23. 01 3月, 2012 2 次提交
    • J
      quota: Make quota code not call tty layer with dqptr_sem held · bf097aaf
      Jan Kara 提交于
      dqptr_sem can be called from slab reclaim. tty layer uses GFP_KERNEL mask for
      allocation so it can end up calling slab reclaim. Given quota code can call
      into tty layer to print warning this creates possibility for lock inversion
      between tty->atomic_write_lock and dqptr_sem.
      
      Using direct printing of warnings from quota layer is obsolete but since it's
      easy enough to change quota code to not hold any locks when printing warnings,
      let's just do it. It seems like a good thing to do even when we use netlink
      layer to transmit warnings to userspace.
      Reported-by: NMarkus <M4rkusXXL@web.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      bf097aaf
    • C
      quota: make Q_XQUOTASYNC a noop · 4b217ed9
      Christoph Hellwig 提交于
      Now that XFS takes quota reservations into account there is no need to flush
      anything before reporting quotas - in addition to beeing fully transactional
      all quota information is also 100% coherent with the rest of the filesystem
      now.
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      4b217ed9