From nobody Fri Nov 22 21:46:41 2024 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A579B1D5CF4; Thu, 21 Nov 2024 12:39:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732192753; cv=none; b=IL/T742AlAyoVhKe+/vRyT+lMcq+iSJDIHH2+DE7DxUwPq8p0JNi3nn4lSguKFO7FYqUn4bHjOb+mOaIYCB/26wCbHcZXH9Stb+GxxhDxxN/M6xzgoNIGhY9CdZXaQJ1nb7B3vP9JIxhvb0UIdanFkEurcx9FpzVxnmrRUN/VSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732192753; c=relaxed/simple; bh=lVZt8MAf7kkaaO+sHrnxX0XCHBKXRF4CIQEBJX6VbmM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fvm8zWAov0x0tYqfLAUiHG5vgdc9h6xBmTfucackXSfg/Rl27qvp+uVM7SPpWPFTf2Bme68NPQHhv2adBi36rtHW8z5aTqGbKSA8Axc/Br1lhqZIEsTUC8llZ8JH7GMY6bwak0K9VfkCyfEIbtcOe18Y0zk/xQSlQVTAN9b4lww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=CXufiznA; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="CXufiznA" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AL8U2wY026462; Thu, 21 Nov 2024 12:39:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=mffRGIB0w7sWnxdiG C3Vnix6diCVwxasN7KuHTWA03M=; b=CXufiznAHQehCCZaWU0911bTAhfP+8xcF uTwBlVLOIjJTZXU6f9M+EcZ3BgjS4OSvb3LuL/+H1cm+x4sie88cLE5Riu8+9cHy RljeYwogejGpFQi94e9QyMPNhyFJQoO1iFJ9pOjnJ6IwcRrBgcWcaEDoC1oMrkAU HgRrvXH8fERCuBcUZjs489sW6poeojfR4oq6Shja7vUuCQpswwH3hcphLynktwWT Gz94GKfIahaWHxafW5Imym2w+01ykdkFnfMoyZDuy8sB/5LQmZ+FSd7R7pLb6eyX E38rk2p8LdwJPnRSc6GVLHyb82OKbvoqd7u/vno6HgS0jBxfjzdLA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42xgttjw27-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2024 12:39:02 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4ALCYT6F025020; Thu, 21 Nov 2024 12:39:02 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42xgttjw23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2024 12:39:02 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4ALC0PMT030928; Thu, 21 Nov 2024 12:39:01 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42y6406v7f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2024 12:39:01 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ALCcxC418743738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Nov 2024 12:38:59 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 618E020040; Thu, 21 Nov 2024 12:38:59 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F134220043; Thu, 21 Nov 2024 12:38:57 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.in.ibm.com (unknown [9.109.253.82]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 21 Nov 2024 12:38:57 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org, Jan Kara Cc: Ritesh Harjani , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Baokun Li , Disha Goel Subject: [PATCH v2 1/2] quota: flush quota_release_work upon quota writeback Date: Thu, 21 Nov 2024 18:08:54 +0530 Message-ID: <20241121123855.645335-2-ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241121123855.645335-1-ojaswin@linux.ibm.com> References: <20241121123855.645335-1-ojaswin@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ysEZuPwQuLBF1DXoG1MEKeKGOq_5nkq7 X-Proofpoint-ORIG-GUID: T5juno6gNEwL7piVe2BgrvMhsc5AMXJy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411210098 Content-Type: text/plain; charset="utf-8" One of the paths quota writeback is called from is: freeze_super() sync_filesystem() ext4_sync_fs() dquot_writeback_dquots() Since we currently don't always flush the quota_release_work queue in this path, we can end up with the following race: 1. dquot are added to releasing_dquots list during regular operations. 2. FS Freeze starts, however, this does not flush the quota_release_work q= ueue. 3. Freeze completes. 4. Kernel eventually tries to flush the workqueue while FS is frozen which hits a WARN_ON since transaction gets started during frozen state: ext4_journal_check_start+0x28/0x110 [ext4] (unreliable) __ext4_journal_start_sb+0x64/0x1c0 [ext4] ext4_release_dquot+0x90/0x1d0 [ext4] quota_release_workfn+0x43c/0x4d0 Which is the following line: WARN_ON(sb->s_writers.frozen =3D=3D SB_FREEZE_COMPLETE); Which ultimately results in generic/390 failing due to dmesg noise. This was detected on powerpc machine 15 cores. To avoid this, make sure to flush the workqueue during dquot_writeback_dquots() so we dont have any pending workitems after freeze. Reported-by: Disha Goel Signed-off-by: Ojaswin Mujoo --- fs/quota/dquot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 3dd8d6f27725..f9578918cfb2 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -688,6 +688,8 @@ int dquot_writeback_dquots(struct super_block *sb, int = type) =20 WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); =20 + flush_delayed_work("a_release_work); + for (cnt =3D 0; cnt < MAXQUOTAS; cnt++) { if (type !=3D -1 && cnt !=3D type) continue; --=20 2.43.5