diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2013-01-31 22:42:40 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-13 09:15:06 -0500 |
commit | ed87dabcc3fc0a5040f95dd3f7206cffebca5c79 (patch) | |
tree | 5b78136ba32b35c63150b3edcc2f05416914b0c4 /fs/gfs2 | |
parent | b59c8b6f9d1b1220e5ed72152f42a658bf739d90 (diff) |
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: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/quota.c | 5 | ||||
-rw-r--r-- | fs/gfs2/quota.h | 2 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 14 |
3 files changed, 16 insertions, 5 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 20762ae2a9c4..47315c091a09 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -1177,13 +1177,14 @@ static int gfs2_quota_sync_timeo(struct super_block *sb, int type) | |||
1177 | return gfs2_quota_sync(sb, type); | 1177 | return gfs2_quota_sync(sb, type); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id) | 1180 | int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid) |
1181 | { | 1181 | { |
1182 | struct gfs2_quota_data *qd; | 1182 | struct gfs2_quota_data *qd; |
1183 | struct gfs2_holder q_gh; | 1183 | struct gfs2_holder q_gh; |
1184 | int error; | 1184 | int error; |
1185 | 1185 | ||
1186 | error = qd_get(sdp, user, id, &qd); | 1186 | error = qd_get(sdp, qid.type == USRQUOTA ? QUOTA_USER : QUOTA_GROUP, |
1187 | from_kqid(&init_user_ns, qid), &qd); | ||
1187 | if (error) | 1188 | if (error) |
1188 | return error; | 1189 | return error; |
1189 | 1190 | ||
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h index 7f67323a6a72..bef805de8491 100644 --- a/fs/gfs2/quota.h +++ b/fs/gfs2/quota.h | |||
@@ -28,7 +28,7 @@ extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change, | |||
28 | u32 uid, u32 gid); | 28 | u32 uid, u32 gid); |
29 | 29 | ||
30 | extern int gfs2_quota_sync(struct super_block *sb, int type); | 30 | extern int gfs2_quota_sync(struct super_block *sb, int type); |
31 | extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id); | 31 | extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid); |
32 | 32 | ||
33 | extern int gfs2_quota_init(struct gfs2_sbd *sdp); | 33 | extern int gfs2_quota_init(struct gfs2_sbd *sdp); |
34 | extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp); | 34 | extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp); |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 8056b7b7238e..e6d8d482422f 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -175,6 +175,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
175 | static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, | 175 | static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, |
176 | size_t len) | 176 | size_t len) |
177 | { | 177 | { |
178 | struct kqid qid; | ||
178 | int error; | 179 | int error; |
179 | u32 id; | 180 | u32 id; |
180 | 181 | ||
@@ -183,13 +184,18 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, | |||
183 | 184 | ||
184 | id = simple_strtoul(buf, NULL, 0); | 185 | id = simple_strtoul(buf, NULL, 0); |
185 | 186 | ||
186 | error = gfs2_quota_refresh(sdp, 1, id); | 187 | qid = make_kqid(current_user_ns(), USRQUOTA, id); |
188 | if (!qid_valid(qid)) | ||
189 | return -EINVAL; | ||
190 | |||
191 | error = gfs2_quota_refresh(sdp, qid); | ||
187 | return error ? error : len; | 192 | return error ? error : len; |
188 | } | 193 | } |
189 | 194 | ||
190 | static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, | 195 | static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, |
191 | size_t len) | 196 | size_t len) |
192 | { | 197 | { |
198 | struct kqid qid; | ||
193 | int error; | 199 | int error; |
194 | u32 id; | 200 | u32 id; |
195 | 201 | ||
@@ -198,7 +204,11 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, | |||
198 | 204 | ||
199 | id = simple_strtoul(buf, NULL, 0); | 205 | id = simple_strtoul(buf, NULL, 0); |
200 | 206 | ||
201 | error = gfs2_quota_refresh(sdp, 0, id); | 207 | qid = make_kqid(current_user_ns(), GRPQUOTA, id); |
208 | if (!qid_valid(qid)) | ||
209 | return -EINVAL; | ||
210 | |||
211 | error = gfs2_quota_refresh(sdp, qid); | ||
202 | return error ? error : len; | 212 | return error ? error : len; |
203 | } | 213 | } |
204 | 214 | ||