diff options
Diffstat (limited to '0021-quota-Prevent-memory-allocation-recursion-while-hold.patch')
-rw-r--r-- | 0021-quota-Prevent-memory-allocation-recursion-while-hold.patch | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/0021-quota-Prevent-memory-allocation-recursion-while-hold.patch b/0021-quota-Prevent-memory-allocation-recursion-while-hold.patch deleted file mode 100644 index 962d80015363..000000000000 --- a/0021-quota-Prevent-memory-allocation-recursion-while-hold.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Matthew Wilcox (Oracle)" <willy@infradead.org> -Date: Sun, 5 Jun 2022 15:38:13 +0100 -Subject: [PATCH] quota: Prevent memory allocation recursion while holding - dq_lock - -[ Upstream commit 537e11cdc7a6b3ce94fa25ed41306193df9677b7 ] - -As described in commit 02117b8ae9c0 ("f2fs: Set GF_NOFS in -read_cache_page_gfp while doing f2fs_quota_read"), we must not enter -filesystem reclaim while holding the dq_lock. Prevent this more generally -by using memalloc_nofs_save() while holding the lock. - -Link: https://lore.kernel.org/r/20220605143815.2330891-2-willy@infradead.org -Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> -Signed-off-by: Jan Kara <jack@suse.cz> -Signed-off-by: Sasha Levin <sashal@kernel.org> ---- - fs/quota/dquot.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c -index a74aef99bd3d6105b07da8ee90f07f1ff15d0c69..09d1307959d085720769839b95f5c99f0478de78 100644 ---- a/fs/quota/dquot.c -+++ b/fs/quota/dquot.c -@@ -79,6 +79,7 @@ - #include <linux/capability.h> - #include <linux/quotaops.h> - #include <linux/blkdev.h> -+#include <linux/sched/mm.h> - #include "../internal.h" /* ugh */ - - #include <linux/uaccess.h> -@@ -425,9 +426,11 @@ EXPORT_SYMBOL(mark_info_dirty); - int dquot_acquire(struct dquot *dquot) - { - int ret = 0, ret2 = 0; -+ unsigned int memalloc; - struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); - - mutex_lock(&dquot->dq_lock); -+ memalloc = memalloc_nofs_save(); - if (!test_bit(DQ_READ_B, &dquot->dq_flags)) { - ret = dqopt->ops[dquot->dq_id.type]->read_dqblk(dquot); - if (ret < 0) -@@ -458,6 +461,7 @@ int dquot_acquire(struct dquot *dquot) - smp_mb__before_atomic(); - set_bit(DQ_ACTIVE_B, &dquot->dq_flags); - out_iolock: -+ memalloc_nofs_restore(memalloc); - mutex_unlock(&dquot->dq_lock); - return ret; - } -@@ -469,9 +473,11 @@ EXPORT_SYMBOL(dquot_acquire); - int dquot_commit(struct dquot *dquot) - { - int ret = 0; -+ unsigned int memalloc; - struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); - - mutex_lock(&dquot->dq_lock); -+ memalloc = memalloc_nofs_save(); - if (!clear_dquot_dirty(dquot)) - goto out_lock; - /* Inactive dquot can be only if there was error during read/init -@@ -481,6 +487,7 @@ int dquot_commit(struct dquot *dquot) - else - ret = -EIO; - out_lock: -+ memalloc_nofs_restore(memalloc); - mutex_unlock(&dquot->dq_lock); - return ret; - } -@@ -492,9 +499,11 @@ EXPORT_SYMBOL(dquot_commit); - int dquot_release(struct dquot *dquot) - { - int ret = 0, ret2 = 0; -+ unsigned int memalloc; - struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); - - mutex_lock(&dquot->dq_lock); -+ memalloc = memalloc_nofs_save(); - /* Check whether we are not racing with some other dqget() */ - if (dquot_is_busy(dquot)) - goto out_dqlock; -@@ -510,6 +519,7 @@ int dquot_release(struct dquot *dquot) - } - clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); - out_dqlock: -+ memalloc_nofs_restore(memalloc); - mutex_unlock(&dquot->dq_lock); - return ret; - } |