Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2457697rwb; Thu, 17 Nov 2022 11:01:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf7MCsU+Zw4m0cKkryqokKfgJt4xPzpgwnq9ZzEyUnrKzT8Yi5cubKYE6sjU37VyTJaw96NV X-Received: by 2002:a62:2504:0:b0:563:1ef3:c920 with SMTP id l4-20020a622504000000b005631ef3c920mr4261986pfl.30.1668711709284; Thu, 17 Nov 2022 11:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668711709; cv=none; d=google.com; s=arc-20160816; b=WoqAPUnC23Z/WSQ2/3SIlbHjfc3DcWwLPHWNC3evI5onJB+wxapg0kCWbC3+wOAxSE +V9jJpeUol2EOui7GSPT/7OG4TYtHfw0SZbQASOnkh3MwIL65S37iPyl3IVvjWcPlGJE gdktMMJTCDZunQFU3bSHqG4EzQXgE3ws5N18KANvlXl6lv9XbsOsftMJPNz4GhEX7KyZ nXYmGYtcC3myddhZ0QN796sB6ze+1NWOxMCUgA8q72XfabCQIEah1WaNPDa6zKj7faSD 3KvX2O+8av1dDHAfKk7OXNACiY8XqB4mT+0B35U/s8jvBt4f1yiRjOWtPpxlvTUw3JhJ /fhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MZYs0tD5VPyy93Ads630jaf2LNyYFWG138gSfeaPw24=; b=aX0jYUsTD2wQ70THbeU/uar3PsSdLzs4wjrG4DiBUyATJ+Ts6IlTr3gl/zZ864cLRS CnAcBqSyxmh4+bQD8+YT2Ipd9RRV1KR84t8FC+0H1CNoJCO75m6Z36s+Kb2GxzQJ327P qpTmTqiQ1JyNUpOkEHmWhsJLq0Gi3rXCp3oypqSYpYI5tECFEEQ/JoSpaIFgdv2WB5v6 dEJQnLSCXreMUsPjO7eVunc9uQekIG1x2Hjd56Ae3sSGhlJRQYpGdiBXEhXHjlQyE4d8 xzyuwFa3aK/mG/T211lzAaMJ5EPKxa3ZxB99T8afHOoZKT54clKR3Rb/uQgvpLLNvdvF o7SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gixku23U; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a62e40a000000b0056cf9ed8f10si1377214pfh.329.2022.11.17.11.01.25; Thu, 17 Nov 2022 11:01:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gixku23U; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235035AbiKQSpe (ORCPT + 99 others); Thu, 17 Nov 2022 13:45:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240695AbiKQSpZ (ORCPT ); Thu, 17 Nov 2022 13:45:25 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807BF8A147 for ; Thu, 17 Nov 2022 10:45:24 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id j12so2452427plj.5 for ; Thu, 17 Nov 2022 10:45:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MZYs0tD5VPyy93Ads630jaf2LNyYFWG138gSfeaPw24=; b=gixku23UgKRkbhGe5AiDlVZZRW6zDUuTRcmelSR2oAI0t77E7K8kFWz9li1UOsal3+ +KohQU1L+my9u67QAdvNYrY74mkNTScefVl1bl5iUKEOQbaXdWQ8u+o6NPOsSHlRswJ6 ebIfNIw0bxDm84g/Boai9URnqIfA+ji/RG0GoBzBus8eAydsneZQ0SvvXPixCVp+9dqz cX68BpHFyNjzNPWsgowxdWuWScmivrd1L5h6jqMwvO+lPGG+J9iy56uymt+ICJNCJeF9 iGnfwAq/Gvo8IJlpe48gCoQc8nSvblpmx/uKaCgkNQMT+i6Nwefy8zHwLSI9NY4hNC/V WzTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MZYs0tD5VPyy93Ads630jaf2LNyYFWG138gSfeaPw24=; b=hIPg8jaTtnMmDe6sbKUgnTFuerRqPtYL0+9wYFmrpeZOl1dueiVY6yenEyY2Pud8T+ mlJwOktZqvUt8dgloYD92oFJwrLvOprY0QfBywtKmr2buvSyzF83lePwxeLQ8cRVKcfR eZ45VfrMQQseGGzDwpqMuRQdco1eFaso4FAQsR8zcrmDG7MNmvFulvYbunkgbEzkiSI8 qlxxNe7kLv7DVRS05zFyNX5/aOX7jRju5s0yhT4+iORu2mlxgFk4hWYXvA6wrszluEG/ 4fQE10HsqDtwU91LloUBZx8GaiCIp2TEONFSQMQbQ8lS2EmB9zbSeGtaKBrKcPO3s0G/ rW+g== X-Gm-Message-State: ANoB5pmXBw39s76j5+AxQD67Y2ZysuRrH416mh2YnlsE2W+s1pgRqbuB 9hcCzUWCtKesMQ3Il+P8Rlw= X-Received: by 2002:a17:902:ab0f:b0:188:f4f4:2000 with SMTP id ik15-20020a170902ab0f00b00188f4f42000mr2593068plb.173.1668710723952; Thu, 17 Nov 2022 10:45:23 -0800 (PST) Received: from localhost ([2406:7400:63:f20b:f6ca:e236:f59f:8c18]) by smtp.gmail.com with ESMTPSA id x11-20020aa79acb000000b00561d79f1064sm1507811pfp.57.2022.11.17.10.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:45:22 -0800 (PST) Date: Fri, 18 Nov 2022 00:15:17 +0530 From: "Ritesh Harjani (IBM)" To: Theodore Ts'o Cc: linux-ext4@vger.kernel.org, Harshad Shirwadkar , Wang Shilong , Andreas Dilger , Li Xi Subject: Re: [RFCv1 01/72] e2fsck: Fix unbalanced mutex unlock for BOUNCE_MTX Message-ID: <20221117184517.rzwt2ba7tqjbhjnq@riteshh-domain> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 22/11/17 11:02AM, Theodore Ts'o wrote: > On Mon, Nov 07, 2022 at 05:50:49PM +0530, Ritesh Harjani (IBM) wrote: > > f_crashdisk test failed with UNIX_IO_FORCE_BOUNCE=yes due to unbalanced > > mutex unlock in below path. > > > > This patch fixes it. > > > > Signed-off-by: Ritesh Harjani (IBM) > > This has been fixed in upstream (for a while, actually); Hello Ted, I think you are speaking about this patch here [1], which prevents the race of using the fd by multiple threads at a time, by using BOUNCE_MTX lock. The current patch on the other hand fixes the unbalanced mutex_unlock(), which can be reproduced with f_crashdisk test with UNIX_IO_FORCE_BOUNCE=yes. (when tested with --enable-threadsan) Below is the threadsan warning that I see. WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (pid=135059) #0 pthread_mutex_unlock (libtsan.so.0+0x3b64a) #1 mutex_unlock ../../../lib/ext2fs/unix_io.c:161 (e2fsck+0x5b392b) #2 raw_read_blk ../../../lib/ext2fs/unix_io.c:331 (e2fsck+0x5b392b) #3 unix_read_blk64 ../../../lib/ext2fs/unix_io.c:1001 (e2fsck+0x5b4981) #4 unix_read_blk ../../../lib/ext2fs/unix_io.c:1053 (e2fsck+0x5b5171) #5 ext2fs_open2 ../../../lib/ext2fs/openfs.c:228 (e2fsck+0x579e5c) #6 try_open_fs ../../e2fsck/unix.c:1242 (e2fsck+0x424e63) #7 main ../../e2fsck/unix.c:1604 (e2fsck+0x41a1d2) Location is heap block of size 376 at 0x7b4800000000 allocated by main thread: #0 malloc (libtsan.so.0+0x32919) #1 ext2fs_get_mem ../../../lib/ext2fs/ext2fs.h:1944 (e2fsck+0x5aec30) #2 unix_open_channel ../../../lib/ext2fs/unix_io.c:698 (e2fsck+0x5aec30) #3 unix_open ../../../lib/ext2fs/unix_io.c:910 (e2fsck+0x5afd67) #4 ext2fs_open2 ../../../lib/ext2fs/openfs.c:175 (e2fsck+0x579918) #5 try_open_fs ../../e2fsck/unix.c:1242 (e2fsck+0x424e63) #6 main ../../e2fsck/unix.c:1604 (e2fsck+0x41a1d2) Mutex M22 (0x7b4800000128) created at: #0 pthread_mutex_init (libtsan.so.0+0x49603) #1 unix_open_channel ../../../lib/ext2fs/unix_io.c:827 (e2fsck+0x5af5ef) #2 unix_open ../../../lib/ext2fs/unix_io.c:910 (e2fsck+0x5afd67) #3 ext2fs_open2 ../../../lib/ext2fs/openfs.c:175 (e2fsck+0x579918) #4 try_open_fs ../../e2fsck/unix.c:1242 (e2fsck+0x424e63) #5 main ../../e2fsck/unix.c:1604 (e2fsck+0x41a1d2) SUMMARY: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (/lib64/libtsan.so.0+0x3b64a) in pthread_mutex_unlock [1]: https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=d557b9659ba97e093f842dcc7e2cfe9a7022c674 > what commit is your patches based upon? 1. This series is rebased on the latest e2fsprogs master branch. https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/log/ Cover letter might provide some more details on how the patch series is broken into. The github link of the series can be found at https://github.com/riteshharjani/e2fsprogs/commits/pfsck-RFCv1 Note: I have provided some details in the cover letter about Patch-073 i.e. ("tests: Add multi-thread tests framework"). But putting it once again here... You can ignore this ^^^ last patch in the github link. This was added to tests all existing e2fsck test with pfsck mode. But later I realized that it will require more work then how it is in the current form. Since I didn't want to hold the patch series any longer and I wanted this series to go through the initial round of review, before it becomes any bigger and difficult to review, hence I decided to drop the last patch from sending it to mailing list. Please let me know if you have any queries on any patch/series. -ritesh