Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed87dabc authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

gfs2: Convert gfs2_quota_refresh to take a kqid



- In quota_refresh_user_store convert the user supplied uid
  into a kqid and pass it to gfs2_quota_refresh.

- In quota_refresh_group_store convert the user supplied gid
  into a kqid and pass it to gfs2_quota_refresh.

Cc: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent b59c8b6f
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -1177,13 +1177,14 @@ static int gfs2_quota_sync_timeo(struct super_block *sb, int type)
	return gfs2_quota_sync(sb, type);
	return gfs2_quota_sync(sb, type);
}
}


int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id)
int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid)
{
{
	struct gfs2_quota_data *qd;
	struct gfs2_quota_data *qd;
	struct gfs2_holder q_gh;
	struct gfs2_holder q_gh;
	int error;
	int error;


	error = qd_get(sdp, user, id, &qd);
	error = qd_get(sdp, qid.type == USRQUOTA ? QUOTA_USER : QUOTA_GROUP,
		       from_kqid(&init_user_ns, qid), &qd);
	if (error)
	if (error)
		return error;
		return error;


+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
			      u32 uid, u32 gid);
			      u32 uid, u32 gid);


extern int gfs2_quota_sync(struct super_block *sb, int type);
extern int gfs2_quota_sync(struct super_block *sb, int type);
extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id);
extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid);


extern int gfs2_quota_init(struct gfs2_sbd *sdp);
extern int gfs2_quota_init(struct gfs2_sbd *sdp);
extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
+12 −2
Original line number Original line Diff line number Diff line
@@ -175,6 +175,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,
static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,
					size_t len)
					size_t len)
{
{
	struct kqid qid;
	int error;
	int error;
	u32 id;
	u32 id;


@@ -183,13 +184,18 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,


	id = simple_strtoul(buf, NULL, 0);
	id = simple_strtoul(buf, NULL, 0);


	error = gfs2_quota_refresh(sdp, 1, id);
	qid = make_kqid(current_user_ns(), USRQUOTA, id);
	if (!qid_valid(qid))
		return -EINVAL;

	error = gfs2_quota_refresh(sdp, qid);
	return error ? error : len;
	return error ? error : len;
}
}


static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
					 size_t len)
					 size_t len)
{
{
	struct kqid qid;
	int error;
	int error;
	u32 id;
	u32 id;


@@ -198,7 +204,11 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,


	id = simple_strtoul(buf, NULL, 0);
	id = simple_strtoul(buf, NULL, 0);


	error = gfs2_quota_refresh(sdp, 0, id);
	qid = make_kqid(current_user_ns(), GRPQUOTA, id);
	if (!qid_valid(qid))
		return -EINVAL;

	error = gfs2_quota_refresh(sdp, qid);
	return error ? error : len;
	return error ? error : len;
}
}