Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327273
b: refs/heads/master
c: 1a06d42
h: refs/heads/master
i:
  327271: 6341bad
v: v3
  • Loading branch information
Eric W. Biederman committed Sep 18, 2012
1 parent 505c33f commit 3f94a36
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b9c7321ca6b13d2baeb82b3c9c9f78e9885bcf5
refs/heads/master: 1a06d420ce9d60b98f5bdf5fd6e4200abfbd3c35
29 changes: 14 additions & 15 deletions trunk/fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ static qsize_t inode_get_rsv_space(struct inode *inode);
static void __dquot_initialize(struct inode *inode, int type);

static inline unsigned int
hashfn(const struct super_block *sb, unsigned int id, int type)
hashfn(const struct super_block *sb, struct kqid qid)
{
unsigned int id = from_kqid(&init_user_ns, qid);
int type = qid.type;
unsigned long tmp;

tmp = (((unsigned long)sb>>L1_CACHE_SHIFT) ^ id) * (MAXQUOTAS - type);
Expand All @@ -267,7 +269,7 @@ hashfn(const struct super_block *sb, unsigned int id, int type)
static inline void insert_dquot_hash(struct dquot *dquot)
{
struct hlist_head *head;
head = dquot_hash + hashfn(dquot->dq_sb, from_kqid(&init_user_ns, dquot->dq_id), dquot->dq_id.type);
head = dquot_hash + hashfn(dquot->dq_sb, dquot->dq_id);
hlist_add_head(&dquot->dq_hash, head);
}

Expand All @@ -277,9 +279,8 @@ static inline void remove_dquot_hash(struct dquot *dquot)
}

static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb,
unsigned int id, int type)
struct kqid qid)
{
struct kqid qid = make_kqid(&init_user_ns, type, id);
struct hlist_node *node;
struct dquot *dquot;

Expand Down Expand Up @@ -816,7 +817,7 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
INIT_LIST_HEAD(&dquot->dq_dirty);
init_waitqueue_head(&dquot->dq_wait_unused);
dquot->dq_sb = sb;
dquot->dq_id.type = type;
dquot->dq_id = make_kqid_invalid(type);
atomic_set(&dquot->dq_count, 1);

return dquot;
Expand All @@ -832,28 +833,26 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
*/
struct dquot *dqget(struct super_block *sb, struct kqid qid)
{
unsigned int type = qid.type;
unsigned int id = from_kqid(&init_user_ns, qid);
unsigned int hashent = hashfn(sb, id, type);
unsigned int hashent = hashfn(sb, qid);
struct dquot *dquot = NULL, *empty = NULL;

if (!sb_has_quota_active(sb, type))
if (!sb_has_quota_active(sb, qid.type))
return NULL;
we_slept:
spin_lock(&dq_list_lock);
spin_lock(&dq_state_lock);
if (!sb_has_quota_active(sb, type)) {
if (!sb_has_quota_active(sb, qid.type)) {
spin_unlock(&dq_state_lock);
spin_unlock(&dq_list_lock);
goto out;
}
spin_unlock(&dq_state_lock);

dquot = find_dquot(hashent, sb, id, type);
dquot = find_dquot(hashent, sb, qid);
if (!dquot) {
if (!empty) {
spin_unlock(&dq_list_lock);
empty = get_empty_dquot(sb, type);
empty = get_empty_dquot(sb, qid.type);
if (!empty)
schedule(); /* Try to wait for a moment... */
goto we_slept;
Expand Down Expand Up @@ -1158,7 +1157,7 @@ static int need_print_warning(struct dquot_warn *warn)

switch (warn->w_dq_id.type) {
case USRQUOTA:
return current_fsuid() == warn->w_dq_id.uid;
return uid_eq(current_fsuid(), warn->w_dq_id.uid);
case GRPQUOTA:
return in_group_p(warn->w_dq_id.gid);
}
Expand Down Expand Up @@ -1898,9 +1897,9 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
if (!dquot_active(inode))
return 0;

if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid)
if (iattr->ia_valid & ATTR_UID && !uid_eq(iattr->ia_uid, inode->i_uid))
transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(iattr->ia_uid));
if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)
if (iattr->ia_valid & ATTR_GID && !gid_eq(iattr->ia_gid, inode->i_gid))
transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(iattr->ia_gid));

ret = __dquot_transfer(inode, transfer_to);
Expand Down
1 change: 0 additions & 1 deletion trunk/init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ config UIDGID_CONVERTED
# Features
depends on IMA = n
depends on EVM = n
depends on QUOTA = n

# Networking
depends on NET_9P = n
Expand Down

0 comments on commit 3f94a36

Please sign in to comment.