From: "Eric W. Biederman" <ebiederm@xmission.com>
To: <linux-fsdevel@vger.kernel.org>
Cc: Linux Containers <containers@lists.linux-foundation.org>,
<linux-kernel@vger.kernel.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Ben Myers <bpm@sgi.com>, Alex Elder <elder@kernel.org>,
Dave Chinner <david@fromorbit.com>
Subject: [PATCH review 12/16] xfs: Remember the kqid for a quota
Date: Sun, 17 Feb 2013 17:11:05 -0800 [thread overview]
Message-ID: <1361149870-27732-12-git-send-email-ebiederm@xmission.com> (raw)
In-Reply-To: <1361149870-27732-1-git-send-email-ebiederm@xmission.com>
From: "Eric W. Biederman" <ebiederm@xmission.com>
- Add q_id to struct xfs_quota
- Modify xfs_qm_dqread to take a struct kqid, allowing xfs_qm_dqread to
set q_id on fresh quota structures.
- Modify xfs_qm_dqget and xfs_qm_init_quota_info to pass a kqid
to xfs_qm_dqread
Cc: Ben Myers <bpm@sgi.com>
Cc: Alex Elder <elder@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
fs/xfs/xfs_dquot.c | 12 ++++++------
fs/xfs/xfs_dquot.h | 3 ++-
fs/xfs/xfs_qm.c | 9 +++++----
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 6be5a29..53c8f67 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -581,8 +581,7 @@ xfs_qm_dqtobp(
int
xfs_qm_dqread(
struct xfs_mount *mp,
- xfs_dqid_t id,
- uint type,
+ struct kqid id,
uint flags,
struct xfs_dquot **O_dqpp)
{
@@ -596,8 +595,9 @@ xfs_qm_dqread(
dqp = kmem_zone_zalloc(xfs_qm_dqzone, KM_SLEEP);
- dqp->dq_flags = type;
- dqp->q_core.d_id = cpu_to_be32(id);
+ dqp->q_id = id;
+ dqp->dq_flags = xfs_quota_type(id.type);
+ dqp->q_core.d_id = cpu_to_be32(from_kqid(&init_user_ns, id));
dqp->q_mount = mp;
INIT_LIST_HEAD(&dqp->q_lru);
mutex_init(&dqp->q_qlock);
@@ -615,7 +615,7 @@ xfs_qm_dqread(
* Make sure group quotas have a different lock class than user
* quotas.
*/
- if (!(type & XFS_DQ_USER))
+ if (id.type != USRQUOTA)
lockdep_set_class(&dqp->q_qlock, &xfs_dquot_other_class);
XFS_STATS_INC(xs_qm_dquot);
@@ -785,7 +785,7 @@ restart:
if (ip)
xfs_iunlock(ip, XFS_ILOCK_EXCL);
- error = xfs_qm_dqread(mp, id, type, flags, &dqp);
+ error = xfs_qm_dqread(mp, qid, flags, &dqp);
if (ip)
xfs_ilock(ip, XFS_ILOCK_EXCL);
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 3566548..0b6020e 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -36,6 +36,7 @@ struct xfs_trans;
* The incore dquot structure
*/
typedef struct xfs_dquot {
+ struct kqid q_id; /* quota identifier */
uint dq_flags; /* various flags (XFS_DQ_*) */
struct list_head q_lru; /* global free list of dquots */
struct xfs_mount*q_mount; /* filesystem this relates to */
@@ -138,7 +139,7 @@ static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type)
XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \
XFS_DQ_TO_QINF(dqp)->qi_gquotaip)
-extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
+extern int xfs_qm_dqread(struct xfs_mount *, struct kqid,
uint, struct xfs_dquot **);
extern void xfs_qm_dqdestroy(xfs_dquot_t *);
extern int xfs_qm_dqflush(struct xfs_dquot *, struct xfs_buf **);
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 836d40d..7e19147 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -673,10 +673,11 @@ xfs_qm_init_quotainfo(
* Since we may not have done a quotacheck by this point, just read
* the dquot without attaching it to any hashtables or lists.
*/
- error = xfs_qm_dqread(mp, 0,
- XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER :
- (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP :
- XFS_DQ_PROJ),
+ error = xfs_qm_dqread(mp,
+ make_kqid(&init_user_ns,
+ XFS_IS_UQUOTA_RUNNING(mp) ? USRQUOTA :
+ (XFS_IS_GQUOTA_RUNNING(mp) ? GRPQUOTA :
+ PRJQUOTA), 0),
XFS_QMOPT_DOWARN, &dqp);
if (!error) {
xfs_disk_dquot_t *ddqp = &dqp->q_core;
--
1.7.5.4
next prev parent reply other threads:[~2013-02-18 1:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 1:04 [PATCH review 00/16] userns: Completion of kuid/kgid/kprojid pushdown Eric W. Biederman
2013-02-18 1:10 ` [PATCH review 01/16] xfs: Convert uids and gids in xfs acls to/from kuids and kgids Eric W. Biederman
2013-02-18 1:10 ` [PATCH review 02/16] xfs: Store projectid as a single variable Eric W. Biederman
2013-02-19 0:36 ` Dave Chinner
2013-02-18 1:10 ` [PATCH review 03/16] xfs: Always read uids and gids from the vfs inode Eric W. Biederman
2013-02-19 1:14 ` Dave Chinner
2013-02-18 1:10 ` [PATCH review 04/16] xfs: Update inode uids, gids, and projids to be kuids, kgids, and kprojids Eric W. Biederman
2013-02-18 1:10 ` [PATCH review 05/16] xfs: Update xfs_ioctl_setattr to handle projids in any user namespace Eric W. Biederman
2013-02-19 1:55 ` Dave Chinner
2013-07-29 7:17 ` Gao feng
2013-07-29 7:51 ` Dave Chinner
2013-07-30 3:15 ` Gao feng
2013-07-30 3:57 ` Dave Chinner
2013-07-30 4:04 ` Gao feng
2013-02-18 1:10 ` [PATCH review 06/16] xfs: Use kuids and kgids in xfs_setattr_nonsize Eric W. Biederman
2013-02-18 1:11 ` [PATCH review 07/16] xfs: Update ioctl(XFS_IOC_FREE_EOFBLOCKS) to handle callers in any userspace Eric W. Biederman
2013-02-19 1:48 ` Dave Chinner
2013-02-18 1:11 ` [PATCH review 08/16] xfs: Use kprojids when allocating inodes Eric W. Biederman
2013-02-19 1:31 ` Dave Chinner
2013-02-18 1:11 ` [PATCH review 09/16] xfs: Modify xfs_qm_vop_dqalloc to take kuids, kgids, and kprojids Eric W. Biederman
2013-02-19 1:57 ` Dave Chinner
2013-02-18 1:11 ` [PATCH review 10/16] xfs: Push struct kqid into xfs_qm_scall_qmlim and xfs_qm_scall_getquota Eric W. Biederman
2013-02-19 2:27 ` Dave Chinner
2013-02-18 1:11 ` [PATCH review 11/16] xfs: Modify xfs_qm_dqget to take a struct kqid Eric W. Biederman
2013-02-18 1:11 ` Eric W. Biederman [this message]
2013-02-18 1:11 ` [PATCH review 13/16] xfs: Use q_id instead of q_core.d_id Eric W. Biederman
2013-02-18 1:11 ` [PATCH review 14/16] xfs: Enable building with user namespaces enabled Eric W. Biederman
2013-02-18 1:11 ` [PATCH review 15/16] userns: Now that everything has been converted remove the unnecessary infrastructure Eric W. Biederman
2013-02-18 1:11 ` [PATCH review 16/16] userns: Remove the EXPERMINTAL kconfig tag Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361149870-27732-12-git-send-email-ebiederm@xmission.com \
--to=ebiederm@xmission.com \
--cc=bpm@sgi.com \
--cc=containers@lists.linux-foundation.org \
--cc=david@fromorbit.com \
--cc=elder@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=serge@hallyn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®