Skip to content

Commit a1e1b2b

Browse files
committed
quota: Drop GFP_NOFS instances under dquot->dq_lock and dqio_sem
Quota code acquires dquot->dq_lock whenever reading / writing dquot. When reading / writing quota info we hold dqio_sem. Since these locks can be acquired during inode reclaim (through dquot_drop() -> dqput() -> dquot_release()) we are setting nofs allocation context whenever acquiring these locks. Hence there's no need to use GFP_NOFS allocations in quota code doing IO. Just switch it to GFP_KERNEL. Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 6c5026c commit a1e1b2b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

fs/quota/quota_tree.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int check_dquot_block_header(struct qtree_mem_dqinfo *info,
108108
/* Remove empty block from list and return it */
109109
static int get_free_dqblk(struct qtree_mem_dqinfo *info)
110110
{
111-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
111+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
112112
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
113113
int ret, blk;
114114

@@ -160,7 +160,7 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk)
160160
static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
161161
uint blk)
162162
{
163-
char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
163+
char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
164164
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
165165
uint nextblk = le32_to_cpu(dh->dqdh_next_free);
166166
uint prevblk = le32_to_cpu(dh->dqdh_prev_free);
@@ -207,7 +207,7 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
207207
static int insert_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
208208
uint blk)
209209
{
210-
char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
210+
char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
211211
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
212212
int err;
213213

@@ -255,7 +255,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
255255
{
256256
uint blk, i;
257257
struct qt_disk_dqdbheader *dh;
258-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
258+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
259259
char *ddquot;
260260

261261
*err = 0;
@@ -329,7 +329,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
329329
static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
330330
uint *treeblk, int depth)
331331
{
332-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
332+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
333333
int ret = 0, newson = 0, newact = 0;
334334
__le32 *ref;
335335
uint newblk;
@@ -410,7 +410,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
410410
int type = dquot->dq_id.type;
411411
struct super_block *sb = dquot->dq_sb;
412412
ssize_t ret;
413-
char *ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS);
413+
char *ddquot = kmalloc(info->dqi_entry_size, GFP_KERNEL);
414414

415415
if (!ddquot)
416416
return -ENOMEM;
@@ -449,7 +449,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
449449
uint blk)
450450
{
451451
struct qt_disk_dqdbheader *dh;
452-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
452+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
453453
int ret = 0;
454454

455455
if (!buf)
@@ -513,7 +513,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
513513
static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
514514
uint *blk, int depth)
515515
{
516-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
516+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
517517
int ret = 0;
518518
uint newblk;
519519
__le32 *ref = (__le32 *)buf;
@@ -577,7 +577,7 @@ EXPORT_SYMBOL(qtree_delete_dquot);
577577
static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
578578
struct dquot *dquot, uint blk)
579579
{
580-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
580+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
581581
loff_t ret = 0;
582582
int i;
583583
char *ddquot;
@@ -615,7 +615,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
615615
static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
616616
struct dquot *dquot, uint blk, int depth)
617617
{
618-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
618+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
619619
loff_t ret = 0;
620620
__le32 *ref = (__le32 *)buf;
621621

@@ -684,7 +684,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
684684
}
685685
dquot->dq_off = offset;
686686
}
687-
ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS);
687+
ddquot = kmalloc(info->dqi_entry_size, GFP_KERNEL);
688688
if (!ddquot)
689689
return -ENOMEM;
690690
ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size,
@@ -728,7 +728,7 @@ EXPORT_SYMBOL(qtree_release_dquot);
728728
static int find_next_id(struct qtree_mem_dqinfo *info, qid_t *id,
729729
unsigned int blk, int depth)
730730
{
731-
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
731+
char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
732732
__le32 *ref = (__le32 *)buf;
733733
ssize_t ret;
734734
unsigned int epb = info->dqi_usable_bs >> 2;

fs/quota/quota_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int v2_read_file_info(struct super_block *sb, int type)
121121
ret = -EIO;
122122
goto out;
123123
}
124-
info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
124+
info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_KERNEL);
125125
if (!info->dqi_priv) {
126126
ret = -ENOMEM;
127127
goto out;

0 commit comments

Comments
 (0)