gfs2: perform quota checks against allocation parameters
Use struct gfs2_alloc_parms as an argument to gfs2_quota_check() and gfs2_quota_lock_check() to check for quota violations while accounting for the new blocks requested by the current operation in ap->target. Previously, the number of new blocks requested during an operation were not accounted for during quota_check and would allow these operations to exceed quota. This was not very apparent since most operations allocated only 1 block at a time and quotas would get violated in the next operation. i.e. quota excess would only be by 1 block or so. With fallocate, (where we allocate a bunch of blocks at once) the quota excess is non-trivial and is addressed by this patch. Signed-off-by: Abhi Das <adas@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Этот коммит содержится в:

коммит произвёл
Bob Peterson

родитель
f1ea6f4ec0
Коммит
b8fbf471ed
@@ -671,12 +671,12 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
|
||||
|
||||
if (alloc_required) {
|
||||
struct gfs2_alloc_parms ap = { .aflags = 0, };
|
||||
error = gfs2_quota_lock_check(ip);
|
||||
requested = data_blocks + ind_blocks;
|
||||
ap.target = requested;
|
||||
error = gfs2_quota_lock_check(ip, &ap);
|
||||
if (error)
|
||||
goto out_unlock;
|
||||
|
||||
requested = data_blocks + ind_blocks;
|
||||
ap.target = requested;
|
||||
error = gfs2_inplace_reserve(ip, &ap);
|
||||
if (error)
|
||||
goto out_qunlock;
|
||||
|
Ссылка в новой задаче
Block a user