1. 21 Sep, 2012 30 commits
  2. 20 Sep, 2012 1 commit
  3. 18 Sep, 2012 9 commits
    • Eric W. Biederman's avatar
      userns: Convert quota · 1a06d420
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      1a06d420
    • Eric W. Biederman's avatar
      userns: Convert struct dquot_warn · 7b9c7321
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      7b9c7321
    • Eric W. Biederman's avatar
      userns: Convert struct dquot dq_id to be a struct kqid · 4c376dca
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      4c376dca
    • Eric W. Biederman's avatar
      userns: Modify dqget to take struct kqid · aca645a6
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      aca645a6
    • Eric W. Biederman's avatar
      userns: Convert quota netlink aka quota_send_warning · 431f1974
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      431f1974
    • Eric W. Biederman's avatar
      userns: Convert qutoactl · 74a8a103
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      74a8a103
    • Eric W. Biederman's avatar
      userns: Implement struct kqid · e8a3e471
      Eric W. Biederman authored
      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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      e8a3e471
    • Eric W. Biederman's avatar
      userns: Add kprojid_t and associated infrastructure in projid.h · f76d207a
      Eric W. Biederman authored
      Implement kprojid_t a cousin of the kuid_t and kgid_t.
      
      The per user namespace mapping of project id values can be set with
      /proc/<pid>/projid_map.
      
      A full compliment of helpers is provided: make_kprojid, from_kprojid,
      from_kprojid_munged, kporjid_has_mapping, projid_valid, projid_eq,
      projid_eq, projid_lt.
      
      Project identifiers are part of the generic disk quota interface,
      although it appears only xfs implements project identifiers currently.
      
      The xfs code allows anyone who has permission to set the project
      identifier on a file to use any project identifier so when
      setting up the user namespace project identifier mappings I do
      not require a capability.
      
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      f76d207a
    • Eric W. Biederman's avatar
      userns: Convert configfs to use kuid and kgid where appropriate · 69552c0c
      Eric W. Biederman authored
      Cc: Joel Becker <jlbec@evilplan.org>
      Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      69552c0c