From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2AA57581B for ; Fri, 16 Aug 2024 09:11:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723799505; cv=none; b=U0DSbuSY5f5X2kGTPxztV/9uCBLhgvDBphzaykGfb+N0++ixSKUAJbMb9QoD/m3IYO9FdOBhT5JFpcO0Blr1v6nYaH0KDbuVDxIeDLHkoNTi2OcAeR+Hm8+m5y5HuXZfCh1Tr8U6/UWAyCnyzCA4ZTCB73yjYM9BtTN7zl8cUdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723799505; c=relaxed/simple; bh=Qw29rppShCdDm6QOLmWc34/CLwzrzgi9ru94pb7hd3M=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=dj27IrP7mGQvIeQxClVp1uu+CqRVUlI35+Evx4PjWgHp/5s1b3yr5lXxvun/WZ+yvTyr3TpA6a6wHKTNDHRFpZgli0kLUI+MSj9eHp0Lg2AArSgVYmXCForm7kwuXb3w0IdmL3IgFj+K63v50wfZUZ1X6+ZGH2GEXD+yXd8kOTY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-39d2dbd9bebso1397335ab.0 for ; Fri, 16 Aug 2024 02:11:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723799503; x=1724404303; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MQeOsbshCLQQEsLzLhQBt7SxIOMZxubosBFbVjVhuLo=; b=WIxlDGZ5v8OV7PAMP6O41S1RRZnsOsybwckGpwqmyhOck8nMANDRXRNaQbBcgIZ+ap kxoPUbMzzQ/musCulJo6tJkNDJmnde2cy3iPUUIMm48ViAs2XrtDA9t3ybiJkxZEkD/I zhVNkw95hjfP4O03MYhWh71clieYgq5fimhrTh5u/waKw1eiJW/RcZLIXSVwrBSkyyEG sgIyGt/5N57SEO9PiMUzqPRNebs+OYgH29g4jh+I/8s/Dm8MzRUZVvg+SfcscPuvsGz9 Z+RjAOk+G6KaUVuuq47i/PLCQxqVBn1DbuXQ8U9ZcQ1o6rDKHdt4Ou7Z34RhZzLzCEDP aStA== X-Gm-Message-State: AOJu0YwHSWVUse9z9tILgDbMTCNS7tbUHVeWY3buY7MpJY7Mgxon7pMC rkCNp3Bn4jnVZneqHU9BL7I0s/nDQTH8IAuedjx7OzU02NKWfrIgV+DiXE9ndu86iK41yqtJtcs DvfVBy4Ysj0UJLRVgxLJwfEEt3RhTq28u5MAV8EWerfLOQdmMsSdYJ4Q= X-Google-Smtp-Source: AGHT+IH3TG3/p7WuY1mraYFCqGGPOZ4CSeMPw96iht0IjSTwKUt6O0ZY4uYUXbJFEXx8FFtyyUikcSAsl4oZLNqqHY5SPstl2i2U Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6e02:1a6e:b0:385:ffe:4516 with SMTP id e9e14a558f8ab-39d26ce52e0mr1328045ab.2.1723799502914; Fri, 16 Aug 2024 02:11:42 -0700 (PDT) Date: Fri, 16 Aug 2024 02:11:42 -0700 In-Reply-To: <0000000000004e582f061fb691ff@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <00000000000009222e061fc959b5@google.com> Subject: Re: [syzbot] Re: [syzbot] [ocfs2?] kernel BUG in ocfs2_iget From: syzbot To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org. *** Subject: Re: [syzbot] [ocfs2?] kernel BUG in ocfs2_iget Author: lizhi.xu@windriver.com BH_Lock state check micro buffer_locked not work? #syz test: upstream d07b43284ab3 diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index cdb9b9bdea1f..f67f82adfee2 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c @@ -148,6 +148,8 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, get_bh(bh); /* for end_buffer_read_sync() */ bh->b_end_io = end_buffer_read_sync; submit_bh(REQ_OP_READ, bh); + printk("bio, jbd: %d, dirty: %d, i: %d, bh: %p, buflocked: %d, bfl: %d, status: %d, %s\n", buffer_jbd(bh), + buffer_dirty(bh), i, bh, buffer_locked(bh), bh->b_state & BH_Lock, status, __func__); } read_failure: @@ -170,9 +172,15 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, continue; } + printk("rf, jbd: %d, dirty: %d, i: %d, bh: %p, buflocked: %d, bfl: %d, status: %d, %s\n", buffer_jbd(bh), + buffer_dirty(bh), i, bh, buffer_locked(bh), bh->b_state & BH_Lock, status, __func__); /* No need to wait on the buffer if it's managed by JBD. */ - if (!buffer_jbd(bh)) + if (!buffer_jbd(bh)) { + if (!buffer_locked(bh) && (bh->b_state & BH_Lock) && bh->b_end_io == end_buffer_read_sync) + lock_buffer(bh); + wait_on_buffer(bh); + } if (!buffer_uptodate(bh)) { /* Status won't be cleared from here on out, diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index e022e40b099e..33c179fa522e 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -411,7 +411,7 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) static inline void wait_on_buffer(struct buffer_head *bh) { might_sleep(); - if (buffer_locked(bh)) + if (bh->b_state & BH_Lock) __wait_on_buffer(bh); }