Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp500813rdb; Fri, 5 Jan 2024 18:48:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPa1IMj73BhEJN51Plfjk/lp48DhvZ8BpoklocAuEgUTElIJcH2Q+gSLD39sIfn1nJKtfb X-Received: by 2002:ac2:46c1:0:b0:50e:70b0:6eac with SMTP id p1-20020ac246c1000000b0050e70b06eacmr102053lfo.121.1704509321728; Fri, 05 Jan 2024 18:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704509321; cv=none; d=google.com; s=arc-20160816; b=EHC4X4kmKGB7NSd/UY2e9SH1d5d9/2/AuNqYllIhDVxZaWD99aeStjCQYMjWTOeO3g QS7v9U9RQeU6kp0pwrR4Y4sJWF6tzJNHGOEfz1cUbej5N4r98l5YfOjZi94c1KRGu8Z2 p0q95fjUyBVGEZONKLTXqsw1iFELuADNB8x+393gG10M9xjjl5K371JyqZnOISJi1Idh qdbU2py0m8iwNyvWr2lPUoZNXs9cCr2sBJKnERrqqTmP4Dbzxpn7DDNahK6ku0pWYTyZ 5zMLgscZJsLeoTUpuAO1ignOM8SHzkxVFrLnp1J0m1NxgDDcWQTZzkoKXTdEA9zvMW5T mRlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=1AupOLE5rTHNAeslsms2/6tnJLNM722AWP+KukkxQGU=; fh=fZFg0PD6QJC6FQHo9F25hcrp9d3al5aGPkmA+VUAjeA=; b=YxX2v7gCti2hxxq3ysN092DKf0NFB6nrDxw86YQqoYyHQUK4vb2FovtPPc/i2hcSkj +uhaDYh7HhLXXDbfeBzNXJYnxqifZWPKcG7MvqxoOuxy6XRGmdT3mdKNBIN80bV28DoV x8nzo+TCj3PEjpmUnZWbXno05dAin4YDYzovUqmW8CqUwT5DK4nLZR7a1W8jl/GaCdhU fC4wXXRZZ67qR2rpMS/EJzMnWWNTD1FHmzf/iQ7PdRjtWHfTMN/+U7cCHxWMTd55rPlq 5rc3MKxjqV0fFy2FcIqKqeiSzt9PgKe15ecl5bR55x+Td/qBu8x3zwIh+HprsEN6YkaM 6mmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18459-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18459-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b26-20020a1709062b5a00b00a26d804d5d4si1135286ejg.873.2024.01.05.18.48.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 18:48:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18459-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18459-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18459-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6BFA71F24231 for ; Sat, 6 Jan 2024 02:48:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFB5115CE; Sat, 6 Jan 2024 02:48:34 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail115-24.sinamail.sina.com.cn (mail115-24.sinamail.sina.com.cn [218.30.115.24]) (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 D7C3015AC for ; Sat, 6 Jan 2024 02:48:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.118.71.254]) by sina.com (10.75.12.45) with ESMTP id 6598BF71000029E5; Sat, 6 Jan 2024 10:48:20 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 48107731457776 X-SMAIL-UIID: E4633905762A40B7A2DD360CE9870677-20240106-104820-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [ext4?] INFO: task hung in ext4_quota_write Date: Sat, 6 Jan 2024 10:48:07 +0800 Message-Id: <20240106024807.3011-1-hdanton@sina.com> In-Reply-To: <000000000000c8a56a060de13553@google.com> References: <000000000000c8a56a060de13553@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Mon, 01 Jan 2024 04:06:21 -0800 > HEAD commit: f5837722ffec Merge tag 'mm-hotfixes-stable-2023-12-27-15-0.. > git tree: upstream > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13177855e80000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master --- x/include/linux/sched.h +++ y/include/linux/sched.h @@ -1544,6 +1544,7 @@ struct task_struct { struct user_event_mm *user_event_mm; #endif + unsigned long bfl; /* * New fields for task_struct should be added above here, so that * they are included in the randomized portion of task_struct. --- x/include/linux/buffer_head.h +++ y/include/linux/buffer_head.h @@ -78,6 +78,7 @@ struct buffer_head { spinlock_t b_uptodate_lock; /* Used by the first bh in a page, to * serialise IO completion of other * buffers in the page */ + struct task_struct *lko; }; /* @@ -402,6 +403,9 @@ static inline void lock_buffer(struct bu might_sleep(); if (!trylock_buffer(bh)) __lock_buffer(bh); + bh->lko = current; + get_task_struct(bh->lko); + bh->lko->bfl = (unsigned long) bh; } static inline void bh_readahead(struct buffer_head *bh, blk_opf_t op_flags) --- x/fs/ext4/super.c +++ y/fs/ext4/super.c @@ -7248,6 +7248,7 @@ static ssize_t ext4_quota_write(struct s brelse(bh); return err; } + BUG_ON(current->bfl == (unsigned long) bh); lock_buffer(bh); memcpy(bh->b_data+offset, data, len); flush_dcache_page(bh->b_page); --- x/fs/buffer.c +++ y/fs/buffer.c @@ -77,6 +77,11 @@ void unlock_buffer(struct buffer_head *b clear_bit_unlock(BH_Lock, &bh->b_state); smp_mb__after_atomic(); wake_up_bit(&bh->b_state, BH_Lock); + if (!bh->lko) + return; + bh->lko->bfl = 0; + put_task_struct(bh->lko); + bh->lko = NULL; } EXPORT_SYMBOL(unlock_buffer); --