From patchwork Sat May 21 10:14:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "heming.zhao@suse.com" X-Patchwork-Id: 12857758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc252.phx1.oracleemaildelivery.com (aib29ajc252.phx1.oracleemaildelivery.com [192.29.103.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D46CC433EF for ; Sat, 21 May 2022 10:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=HVq4Atxx4rvn+d+qMoMWcWjIlse/jyN7NxIV1MgqIL4=; b=uFsWbtpFA3BHFVDgrC66SrvTxbUsk3+H9mweMZUItsqc1Z4qTZ0fgCHN7ibxcMzhGU6z22WOzk/J hbt20JdMXOGyyKy/XonFaDzToIlOPVvE+kXVmQOhTGOJYXdt8cChVcBxWSX8Z7rgw3YpxCYtWdvu HTnPntIcrrOVmJ70vTA3/dkIkVhlFrd7DHuCWi/ij3G9enaMt3Xppvs/fvNsYHCiBgq//cxzKh+Z UvhIchRlTMZAoyFbyf/ior0pN+33G1RfEOcdhF2gP8f2n2MLhCfBBZh3OY8xR7H2UjMgaKtCQhkB Wjc7WiRM5DXOojC7X0Wkc5ilI60DFhCsa0YTAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=HVq4Atxx4rvn+d+qMoMWcWjIlse/jyN7NxIV1MgqIL4=; b=cVQ3/RyFRrrWxVrezxMBBdEwYjFnCiAcATvWTpdlH0XFsDiTXZaDufyQ16i87OP5Y7lNKqvc0xOx j8LX6WNn8NUCcjsln+KBSMU7xzTUxYo1+WiRKEtpTgz40AgTa0WVqMxQqIavDOzqIDdVtF+khoNW EIcoZqEjflrFP9jSVRG/uMiOY1FNOQonAYJAmWccetNp2Einh8i+Q4/OsiMI8pCJSFuokqIErZ56 uef8QZdLu8ClWdQ8UryoFPzPOqTuNTpprvmuITtUwZSJLiexfFfXN3WHl2HPYmqtuHSLqCp+wr9o psBJ+Ii1txGWdpMPk3FFKtc8C44EZ+3bUKLW3w== Received: by omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220413 64bit (built Apr 13 2022)) with ESMTPS id <0RC8005TQ9SQU7B0@omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 21 May 2022 10:14:50 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1653128071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oM3c3SD+f06uAuuWzZm+Y7lk5IAciOy7GKNYczD8edE=; b=nBlYiu6i8IalbUiqZPvlPh6NePiYutx3RPipaq/7QKVONzbxmipkhmAsSyBtHiy+0uFd0o HMT3xNPKgElXhD0/Y3TZ5wI5B0b7q5c7Sj4nnypsFQPDh0zJFRaJ107CWowLbnqGrChBHM xm6SS8aZ0FGqm5Ctlk0PfebMLQeOeuk= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TVpqXlfnRT6UrHcEDyyvKLu+g43WfKqLMO5gBnngb0osH733HyuE5Hm033+vg/mgXowyJ5PQ1OVAHp4Sxz7P4tqdF3FYVwP7+/2NMK3gvV/XxdLVwp7kyB+nUfYLU+2n0/7+t1a43H6BlRacXhV7bT54rJUIL/iic1pg3xI+iGmIkyQA59NepwQtfQEfHXPqhYqQ+LVezbj1MnAj4pRBl9fMhfMatYGZt1H1tStd4kHoKQllhs6YTyJYGzVaTRaXdN63uCslDwG9DcnhvXqEDKLBzbNLys8r0wNTQvyn4MQ+U4X+j8OeAgXWEAWRadB/XD6P7vZTDgNPcBsiuo95yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PVoGT7V5+TVxzQa9ZeiOlvjxQriLH60Wh/r2d8qmfV8=; b=AHxBzpbdM/BH2vId1VIGCRBKhXvIYgn2shyi7/VVjOtfhB5iNed8J/O1OquESnwrp8ZpfZRF4I9s7mHCBIB8zwG0vYK9IVUAT65rBBRWgS3XwdT59pGXu0p0dzx1fqa+NXSV1vz4PunjTvrA/yHddS4mliHvSEL8oNp+gKwi/gJ316life8UAdzKzJF90WnnH5+3Fl33RYkcklsmkcmfDR6dP7vO6OA/rk+WyQvNKCSy362UYhEdi0tnykNuK9r/IZXo8zjDHT8XKR33TBnT+L3PcZLLYhaxtytzBxOx/hVWYQ9EQkjkMXCzl9q/mm+o12EIXArNsfmJ3rYFWRz5qQ== ARC-Authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none To: ocfs2-devel@oss.oracle.com, joseph.qi@linux.alibaba.com Date: Sat, 21 May 2022 18:14:15 +0800 Message-id: <20220521101416.29793-1-heming.zhao@suse.com> X-Mailer: git-send-email 2.34.1 MIME-version: 1.0 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR04MB4666.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(86362001)(6666004)(38100700002)(508600001)(8676002)(316002)(6486002)(66946007)(66556008)(4326008)(186003)(1076003)(83380400001)(6506007)(2616005)(5660300002)(26005)(6512007)(44832011)(107886003)(36756003)(8936002)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2022 10:14:28.1176 (UTC) X-Source-IP: 194.104.111.102 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10353 signatures=594197 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 mlxlogscore=616 suspectscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 priorityscore=164 spamscore=0 adultscore=0 mlxscore=0 clxscore=182 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205210062 Subject: [Ocfs2-devel] [PATCH 1/2] ocfs2: fix jbd2 assertion in defragment path X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Heming Zhao via Ocfs2-devel Reply-to: Heming Zhao Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-MC-Unique: GZ833OmZOSu3yOeQnZum_Q-1 X-ClientProxiedBy: TYAPR01CA0203.jpnprd01.prod.outlook.com (2603:1096:404:29::23) To DB7PR04MB4666.eurprd04.prod.outlook.com (2603:10a6:5:2b::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0efa0cde-371b-4b71-403b-08da3b12b037 X-MS-TrafficTypeDiagnostic: AM0PR04MB5556:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bCu7Z4BQy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Q1tr2DUYpw1Loth4fK+Vth2dKg8W4Jxx0Sp7pTdUr4PQd7q6lf8nP8gCtuBWLYCqiozyme0qY6ernGI+0rHtu9VSiKhKJesBu2U7VHowpQAea0qaf//OWKL9r4UtiOSgUJvO9WRbzDhBIN7pToxNiX4YnjFHMDGAetdIMODoSs4lzWYQdjJyuJsb8ud3gcBndM7kHihmFA6zRX1JCREPMdoZzx30G54V2NfpMG/RZrOEwtMQrpXmMcMSocfu/iycSz2j0bK8Z6sR1Sffl54EgA== X-MS-Exchange-CrossTenant-Network-Message-Id: 0efa0cde-371b-4b71-403b-08da3b12b037 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4666.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eAm7PfeOLsgRSeKYs7K2sguNe4/jqNp/de+W3avEAedR68oUQYUiE/MBoQLsmPhWLNCooY4v42F0esPS1XAQkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5556 X-ServerName: de-smtp-delivery-102.mimecast.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 include:spf.suse.com include:de._netblocks.mimecast.com include:amazonses.com include:spf.protection.outlook.com include:_spf.qemailserver.com include:_spf.salesforce.com -all X-Spam: Clean X-Proofpoint-GUID: YqEXcbzkSsGBN-yRAopauqOr1I3VcFw9 X-Proofpoint-ORIG-GUID: YqEXcbzkSsGBN-yRAopauqOr1I3VcFw9 Reporting-Meta: AAHthZZ52wL+yu2fQ0N/tucFbWh65VhVcC5mxnxcuG8CdqwKCaiW0GHbmCkFtv6v xR9VjofiWWJNg5Hup8jazTnNvLxxmnL6tPhybbRv/nXeGIOYO3Ofglm8IH9YW87J x8/YrsU0XhTe345ndhj8hOjbvfhVDLZ7HfgNDN8JAyDSbG1hfO5Svl/RHQ+eduvC pkxj/uOmNj0zaBwGnX04gNPWH4NdhZJNCeWfONjggNY/bSKRZtcMM1uCBhcBRxj3 Z9SzWAKxzg9Hfr36EbSLZBLj5zs/Sbn7pJzj/zUkfjQXmOjL9/CrLi0o8KhlwhlL 4i6udLezGjoNG+bYZZGbfc2Cf6qSxeRKO/9QuTQE8k69m0onvuDTdUXUhZzzSGG4 qacSosMuLWzZ4NbxVVPNrfT9q0cKHC1zS9Om8D4RAvMlHFzBcg1qrT2B3xM026Ii nyui5GhyoCye7qtT3CW56H5UpMn5RAKvmxtukKMgs7kdwiHXrU1FlwMn0HXy0Wjn kn1eu6vOWIukiwKZbYkvhjXRgnWtuUSMeWhHtdN7W8/PoA== defragfs triggered jbd2 report ASSERT when working. code path: ocfs2_ioctl_move_extents ocfs2_move_extents __ocfs2_move_extents_range ocfs2_defrag_extent __ocfs2_move_extent + ocfs2_journal_access_di + ocfs2_split_extent //[1] + ocfs2_journal_dirty //crash [1]: ocfs2_split_extent called ocfs2_extend_trans, which committed dirty buffers then restarted the transaction. The changed transaction triggered jbd2 ASSERT. crash stacks: PID: 11297 TASK: ffff974a676dcd00 CPU: 67 COMMAND: "defragfs.ocfs2" #0 [ffffb25d8dad3900] machine_kexec at ffffffff8386fe01 #1 [ffffb25d8dad3958] __crash_kexec at ffffffff8395959d #2 [ffffb25d8dad3a20] crash_kexec at ffffffff8395a45d #3 [ffffb25d8dad3a38] oops_end at ffffffff83836d3f #4 [ffffb25d8dad3a58] do_trap at ffffffff83833205 #5 [ffffb25d8dad3aa0] do_invalid_op at ffffffff83833aa6 #6 [ffffb25d8dad3ac0] invalid_op at ffffffff84200d18 [exception RIP: jbd2_journal_dirty_metadata+0x2ba] RIP: ffffffffc09ca54a RSP: ffffb25d8dad3b70 RFLAGS: 00010207 RAX: 0000000000000000 RBX: ffff9706eedc5248 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffff97337029ea28 RDI: ffff9706eedc5250 RBP: ffff9703c3520200 R8: 000000000f46b0b2 R9: 0000000000000000 R10: 0000000000000001 R11: 00000001000000fe R12: ffff97337029ea28 R13: 0000000000000000 R14: ffff9703de59bf60 R15: ffff9706eedc5250 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #7 [ffffb25d8dad3ba8] ocfs2_journal_dirty at ffffffffc137fb95 [ocfs2] #8 [ffffb25d8dad3be8] __ocfs2_move_extent at ffffffffc139a950 [ocfs2] #9 [ffffb25d8dad3c80] ocfs2_defrag_extent at ffffffffc139b2d2 [ocfs2] The fix method is simple, ocfs2_split_extent includes three paths. all the paths already have journal access/dirty pair. We only need to remove journal access/dirty from __ocfs2_move_extent. Signed-off-by: Heming Zhao --- fs/ocfs2/move_extents.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 192cad0662d8..6251748c695b 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c @@ -105,14 +105,6 @@ static int __ocfs2_move_extent(handle_t *handle, */ replace_rec.e_flags = ext_flags & ~OCFS2_EXT_REFCOUNTED; - ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), - context->et.et_root_bh, - OCFS2_JOURNAL_ACCESS_WRITE); - if (ret) { - mlog_errno(ret); - goto out; - } - ret = ocfs2_split_extent(handle, &context->et, path, index, &replace_rec, context->meta_ac, &context->dealloc); @@ -121,8 +113,6 @@ static int __ocfs2_move_extent(handle_t *handle, goto out; } - ocfs2_journal_dirty(handle, context->et.et_root_bh); - context->new_phys_cpos = new_p_cpos; /*