quota: Prevent memory allocation recursion while holding dq_lock
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 5 Jun 2022 14:38:13 +0000 (15:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jun 2022 12:21:56 +0000 (14:21 +0200)
commit38ed8ab3171d0a9e8dac6cd49bf288bf7184a3da
tree04fe2ca36d54a70f0f76a8d6e626441e3a6c9374
parentff128fbea720bf763fa345680dda5f050bc24a47
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