From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 736253A75BE for ; Wed, 25 Mar 2026 17:58:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774461544; cv=none; b=GKnxAXrKg9eMhWGTjrEVcU+nZmsJ1+KXxyzQonWCl230qw0TRBcN4SjB0PrcTaHmDVu0mwy2qJzUSQvS5DCucBypv1OvZPM6cCsJ1+gdorMNNtldpAzQUM9x2W1b3HuYZZ/sbCNdk9a/7xX8CyB2FGxmINO6Wq5PAfdtQ8nWAIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774461544; c=relaxed/simple; bh=27WiXbuz7LQ7SUuHNpU/TxCpmFZwuLH8dnK7tVbqWYk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jTZ9ZUnSMxwxYAXpz0ysiLrVU1pyMDvdaGkkjIiWlbT1274+H1a/XV5A80gdg2PzZhj8f/31Jdj7dRs5PmkRVMF2nbk0vARCmcuIOjz4k52NrCopyqRR8AuxPWbyhWR8v11zogWFEBf7I4JX2lO7i0k6Evr+Bsr/7hrfngt6O+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Xsk7HYDa; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ANVy5RqS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Xsk7HYDa"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ANVy5RqS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774461538; 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: in-reply-to:in-reply-to:references:references; bh=XV6+p1ZjMFp6dFSyL4EnqGiwU7NN8uAoneHl7K50Fzw=; b=Xsk7HYDaRJDr/9vn/67siBdL7W2OtbR2XUaF0ULk0Fm8ylkyXsQfOcrf3I6ywruz/KGiup +DpA94meFdwaLNs2zxQZsJrvKjkE/ai4OH7a3klHIoQaCunvKPTWZx2uR2+gzc62NuV6Sk Hm6dkjo9PJ2JW5iJ89q0oT9UBbKSBPw= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-461-2-7ZlnDgO3eqqXtdGxbGaQ-1; Wed, 25 Mar 2026 13:58:56 -0400 X-MC-Unique: 2-7ZlnDgO3eqqXtdGxbGaQ-1 X-Mimecast-MFC-AGG-ID: 2-7ZlnDgO3eqqXtdGxbGaQ_1774461535 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-43b8cb800f5so106233f8f.1 for ; Wed, 25 Mar 2026 10:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1774461535; x=1775066335; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=XV6+p1ZjMFp6dFSyL4EnqGiwU7NN8uAoneHl7K50Fzw=; b=ANVy5RqSxmetMuoV9jUNFrgilr8yMUbX4wfAP9q3LRW9QQaHJZuNOvcydeG+pyuGuw qZ8w7OlevvpaFwJY3owN+bHu/CU2ryaL46zVi7QuNxGZfMW32A8HBB89aaOzVHqKWMOW 2b4N2XMzU9EFu+78iEA2j78p4KhzlSXHXszXkh3goDwrKYXyX3GaaTHjDPkvsNoosTd8 jEHVgboYqMIPLJWQuEE20mbu4QTGA9rdykcQ6nkmJe8QXbO6fGqrbypuWsdfZ/DzzDB7 Nhmgt6f0uovfhAPRB3DVogpOt1bdrqMPVH53/EBv0t2n/Z01TFfRQEnC0vNhMu+3uME0 s9lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774461535; x=1775066335; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XV6+p1ZjMFp6dFSyL4EnqGiwU7NN8uAoneHl7K50Fzw=; b=N3hQQZg2NenhnxcmgMbYrCI9GxDB7FxejF1WNGfwa30F6TYObUBHG+xzAUgnpM50fu UJi79T8vYRNPZJ2nSxDD9C2xWmeCY12lC37zecWmNjLFkwO6Ha7ci6ZcIieBir3/pmiA lnrjfKJSyWbkT46hfQTYk/VGNx/aNYxe2TdZ3HIZYMMH1rmP75eGokDhqzOVlzndgFpQ d1px+IMbECKQLsghBWCOrFAQs/cHP+dFmonXSnO3KKcq6JX5Y9aVes+bW/oDH3tA94I1 eQNx6DKYyHPZ0mS/9IpLKI2nfR8KSSDTyzYIr8H5l4qzKCiakEYj7480hjdQFBVN13HQ EAWg== X-Forwarded-Encrypted: i=1; AJvYcCX0BtU/hzG6oHWBWXQ8/6Z1zmVxQtYVUSOl2n3M3oTZqJTnp0DUXByRRalQjdWq55LFNOmt5t8ILg4SewI=@vger.kernel.org X-Gm-Message-State: AOJu0YxUgmbbRrACEdrPOzNqwcHYZOr7pCCn7lnxzxJD7IfsqGXkYIb8 KEViESMdx9cBTuQr4ozB5ZDLhD1LabhTaXTTPR4mz2Fd+oUEvSB60nEKMTMNPP4op5oPk6OINQ2 1g0upSmlLMzjZoMgGgd5lKbPwzOIZQUKi1/7BM6mL+WYYvenPgfy3jc5QZsh/49TwTA== X-Gm-Gg: ATEYQzx/4eIpGk8cPy6g9LMrQzY/V6x3liiwrNpa4g82MAs23mwjTOSrWGbVVEXYqUx jbtOePVGC/M42AsyAo8UR3A7iNdoXoFO4i13hs/nT+hr+NDlUFNdggig6Xk32LHWDsZjXe/rVE/ KUiav5sMe1jIjvCgvt3PBUxLh+YRohUUx8CS5y33E9ZAbJSCqqTWHkVoHAxN/1w4iFnJ+jSLlp7 856NOYhCPROYzaai7FOMkWDJv/p4YE49dnV2rBzeUiv5gLeyVRlm/tskOUr9v64Hujub9umI2QC 6TjmY459fRscIJJJ1eIjhJKsaMvNP4Q9ooCYxeSuu4UdE08wniFxFXqr1Cz+hZ3sKeojCevp7ZW cJG3HwH1jNBdmKTQAHjAw2eBT0NuLZuP5Vd3IvxDfbKQdt0Nx/MiA7V3v/1aONpBXkWY9IVq8O3 l1CT/g9A== X-Received: by 2002:adf:e6cd:0:b0:43b:4989:869d with SMTP id ffacd0b85a97d-43b88a055f2mr4780230f8f.33.1774461535230; Wed, 25 Mar 2026 10:58:55 -0700 (PDT) X-Received: by 2002:adf:e6cd:0:b0:43b:4989:869d with SMTP id ffacd0b85a97d-43b88a055f2mr4780206f8f.33.1774461534738; Wed, 25 Mar 2026 10:58:54 -0700 (PDT) Received: from [192.168.1.167] (cpc76484-cwma10-2-0-cust967.7-3.cable.virginm.net. [82.31.203.200]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b919df85csm1719148f8f.28.2026.03.25.10.58.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Mar 2026 10:58:54 -0700 (PDT) Message-ID: Date: Wed, 25 Mar 2026 17:58:53 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gfs2: fix duplicate kmem_cache name on concurrent mounts Content-Language: en-US To: Deepanshu Kartikey , agruenba@redhat.com Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, syzbot+b441db1854c360b83221@syzkaller.appspotmail.com References: <20260325060506.4868-1-kartikey406@gmail.com> From: Andrew Price In-Reply-To: <20260325060506.4868-1-kartikey406@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 25/03/2026 06:05, Deepanshu Kartikey wrote: > When gfs2_fill_super() creates the per-filesystem bufdata cache, it > uses sd_fsname as part of the cache name: > > sdp->sd_bufdata = kmem_cache_create("gfs2-bufdata/", ...); > > At this point sd_fsname is set from sd_table_name (e.g. "syz:syz"), > which is the same for all concurrent mounts of the same device. > The unique suffix (.s for spectator, .N for journal ID) is only > added to sd_fsname AFTER wait_on_journal() completes, since the > journal ID is assigned by the locking subsystem during mount. > > With multiple concurrent mounts of the same device (as triggered by > syzkaller with procs:5), multiple calls to gfs2_fill_super() all try > to create a cache named "gfs2-bufdata/syz:syz" before any of them > reaches the point where sd_fsname becomes unique, triggering: > > kmem_cache of name 'gfs2-bufdata/syz:syz' already exists > WARNING: mm/slab_common.c:112 > > Fix this by moving the bufdata cache creation to after > wait_on_journal() completes and sd_fsname has been updated with its > unique suffix. Also move the fail_bufdata cleanup label accordingly > in the error unwind path. I don't think the description is accurate as the patch moves the kmem_cache_create() to after the gfs2_sys_fs_add(), which fails the mount cleanly on a duplicate lock table instead of triggering a warning. That said, 767e4de3ffce ("gfs2: per-filesystem bufdata cache") is likely to get pulled out of for-next as it was more of a debugging aid so it's probably not worth a v2. Andy > > Reported-by: syzbot+b441db1854c360b83221@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=b441db1854c360b83221 > Fixes: 767e4de3ffce ("gfs2: per-filesystem bufdata cache") > Tested-by: syzbot+b441db1854c360b83221@syzkaller.appspotmail.com > Signed-off-by: Deepanshu Kartikey > --- > fs/gfs2/ops_fstype.c | 21 ++++++++++----------- > 1 file changed, 10 insertions(+), 11 deletions(-) > > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c > index b44adb40635d..7f8e04c11494 100644 > --- a/fs/gfs2/ops_fstype.c > +++ b/fs/gfs2/ops_fstype.c > @@ -1198,17 +1198,9 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) > if (!sdp->sd_delete_wq) > goto fail_glock_wq; > > - char *bufdata_name = kasprintf(GFP_KERNEL, "gfs2-bufdata/%s", sdp->sd_fsname); > - sdp->sd_bufdata = kmem_cache_create(bufdata_name, > - sizeof(struct gfs2_bufdata), > - 0, 0, NULL); > - kfree(bufdata_name); > - if (!sdp->sd_bufdata) > - goto fail_delete_wq; > - > error = gfs2_sys_fs_add(sdp); > if (error) > - goto fail_bufdata; > + goto fail_delete_wq; > > gfs2_create_debugfs_file(sdp); > > @@ -1255,6 +1247,15 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) > snprintf(sdp->sd_fsname, sizeof(sdp->sd_fsname), "%s.%u", > sdp->sd_table_name, sdp->sd_lockstruct.ls_jid); > > + char *bufdata_name = kasprintf(GFP_KERNEL, "gfs2-bufdata/%s", sdp->sd_fsname); > + > + sdp->sd_bufdata = kmem_cache_create(bufdata_name, > + sizeof(struct gfs2_bufdata), > + 0, 0, NULL); > + kfree(bufdata_name); > + if (!sdp->sd_bufdata) > + goto fail_sb; > + > error = init_inodes(sdp, DO); > if (error) > goto fail_sb; > @@ -1304,6 +1305,7 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) > if (sb->s_root) > dput(sb->s_root); > sb->s_root = NULL; > + kmem_cache_destroy(sdp->sd_bufdata); > fail_locking: > init_locking(sdp, &mount_gh, UNDO); > fail_lm: > @@ -1313,8 +1315,6 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) > fail_debug: > gfs2_delete_debugfs_file(sdp); > gfs2_sys_fs_del(sdp); > -fail_bufdata: > - kmem_cache_destroy(sdp->sd_bufdata); > fail_delete_wq: > destroy_workqueue(sdp->sd_delete_wq); > fail_glock_wq: