From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (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 9B22A314A9F for ; Fri, 12 Dec 2025 10:12:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765534359; cv=none; b=WRQwGMCSTdor9E6WgrrtzHDiYsBPiSrGdfI8avTbhNM+jiGXwVT5dMcmzUKoX5SX3CJLBcb9D/amKfloLr/3/dWD7EEJuy5HCqfLCDx2WMWMO725tJk+Cqs/o4QR6orgLC8BWepbttV+GwBwAB1eu2RSg/35u1mALwIz15Kxym0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765534359; c=relaxed/simple; bh=gzQjeuzK8OvsG95sV2x0e18zLLQ1/JQTFC2nyRSpltE=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=OjXYQeVZNG1FF8qI9l9YpaZIsI8mC+q02jAtVgX7laD3Dx6hXMBAfwUpkyokFPBNyZI9pDtV6Se8aDc+TPH2/pnCW+Z/1jDWSyrDGJJgHWUdiVHYD/E2cxvc13Cm73FTJ0+Xa/uZprCL2LBATDr9a7RQ24JflARaT2gjtxEgUjs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ddzcjvSN; arc=none smtp.client-ip=209.85.128.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ddzcjvSN" Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-78c696717dbso10520017b3.1 for ; Fri, 12 Dec 2025 02:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765534356; x=1766139156; darn=vger.kernel.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=tyiWj+teLSvOcemqfQ8kWGe8XZlNZ+qzMwX7g7wGHpA=; b=ddzcjvSNzCDvK3aJt9L2zOcCD6TCcs5Gk7aEzAcVX2Asvo6Bk7vG4EKRLCr1AVLrlT uGbaO87d6bWQtq2a//UzHdN1B+Ct7YeFAuICF73hlOF7yP+cQbutYtbCUScu8LmX44ra NkgfKuLgQWTlA1ciG34Tph9Yua1OapgDG3iI6I5I2wsuuwzcU+R/yf5sGAKCP6k6VnC1 qepH0m6MqgpscwM316GEqSe/n75rrGF4RT9t2Wlf+ISGDJ1pHYlsRmi85wc4CkS0ATTX tdYoP97095UtTpn36MxCw3RVlFcq3IfLUqPRhd6rMiIoDQlKxqSyM0RKJsRd61Q/MQWg +4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765534356; x=1766139156; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tyiWj+teLSvOcemqfQ8kWGe8XZlNZ+qzMwX7g7wGHpA=; b=B6d4hXYwB1Cr0U9yCBS+DVHt697aiIxfa92vg82N0kRWcQ3o8+dX6+8mbb4Z5jiQgd 2lg1f1y+OqhqD8WBThmXv6BNeYYh5+KDxU+Obm/fzlAkHkegXtzjBn0ElArA8VxlTZqS P5jObnrCf2Nvw7AX01lKwr4BFvVAx8XLj5QLqwFJ4L+GLqriB50GjPrXZvaxr8iU+kHJ YQFqyQ6IR0H/WZBz+WO7WHHQbd9MjgbxEYCh356p5fCwuGqy6v4woJeIZx2Ip7JKt7XX gedIbFikZjvqekHGF8cGcRCnMwsMO5KQ0jOoiZOHxd0HGA8v4LwjEte6C4wZDZyv3Nt+ beww== X-Forwarded-Encrypted: i=1; AJvYcCWsl/HiQh8r325tfTomzD5gDKfxqlrx1BykF61oHp02Azh0PgnWpIleWsXUCLrmc2LXZ2i9i0ICx2jUenU=@vger.kernel.org X-Gm-Message-State: AOJu0YzCL5A+Ts2BIwvYLoNg/2CSW6lx4zoT2W1XAGYv3+cQO7E0N33i UcLvFK9b0QRZC+I0dHVGR5XqTtYtYTlMm5Gx1glIQa/yhdL7IPRVMBuliOpCR5Mhmp08+iaQxiT +zQ/ryQ== X-Gm-Gg: AY/fxX4z09ZQ86kVYYfoXq3fFgVT6e+bCbhxGHhGkhNA4D89rZaxWKmTDLurZJ027Pc YSrXefaLC0WSe6IozLVZyyL0hoYSOz4ryYyZqwWQfi86M4tSRnkU7LJ92x0arUnR5Cybe/tqvm1 ji9JffcVCSs1/738DMXoS3UJOlsDmFkslpleM1U3LsRKSvdWdq3rWVMRaycHRFVOwT2+8Rqp35I rgHZ2iNDB7RABzp92LBI7dSLBv8cf5/W0Z7E9X+0yBwYadSnxbUo8cgTbe/jAIESpwbxRkchpDU p1oiKb4GyqtoCL6x/GIswZ1gnFbTdc/87XRChUQDesaXDCedz0xxLhQP8egztVlqKz8NZ7m4Nzu A7ghjPRvu1TWwgo92ENtl8dIbrnGnbT61IgHJhzHT318fH9bWFA7N85WR5iTeBknbhBqwrlL3Ei aoUVAPzTIlfUMrkj9CTNTVV7O80jsVuQJ64N85M4PbuVf/OAl+NEMCSl5FJdqcSZJmbfEndvWdW rPJ0jFXZg== X-Google-Smtp-Source: AGHT+IGKtXEzcTRKcustuNEfSG9GQgq2I5s1vamHi1Jm95rHy6d13FrXiicoayqFzE3hF90bPUJ+gA== X-Received: by 2002:a05:690e:4105:b0:645:591a:cb5e with SMTP id 956f58d0204a3-645591accdfmr267163d50.5.1765534356223; Fri, 12 Dec 2025 02:12:36 -0800 (PST) Received: from darker.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78e6a46397csm3097617b3.53.2025.12.12.02.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 02:12:34 -0800 (PST) Date: Fri, 12 Dec 2025 02:12:17 -0800 (PST) From: Hugh Dickins To: Al Viro cc: Hugh Dickins , Miklos Szeredi , Christian Brauner , Andrew Morton , Baolin Wang , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: 6.19 tmpfs __d_lookup() lockup In-Reply-To: <2a102c6d-82d9-2751-cd31-c836b5c739b7@google.com> Message-ID: References: <47e9d03c-7a50-2c7d-247d-36f95a5329ed@google.com> <20251212050225.GD1712166@ZenIV> <20251212053452.GE1712166@ZenIV> <8ab63110-38b2-2188-91c5-909addfc9b23@google.com> <20251212063026.GF1712166@ZenIV> <2a102c6d-82d9-2751-cd31-c836b5c739b7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Thu, 11 Dec 2025, Hugh Dickins wrote: > On Fri, 12 Dec 2025, Al Viro wrote: > > > > A few more things to check: > > > > 1) do we, by any chance, ever see dentry_free() called with > > dentry->d_flags & DCACHE_PERSISTENT? > > No. > > > > > 2) does d_make_persistent() ever call __d_rehash() when called with > > dentry->d_sb->s_magic == TMPFS_MAGIC? > > Yes, both if shmem_whiteout() does its d_rehash() and if it does not. > > > > > 3) is shmem_whiteout() ever called? If that's the case, could you try > > to remove that d_rehash() call in it and see what happens? Because > > that's another place where shmem is playing odd games... > > Yes, shmem_whiteout() does get called. > > And when I remove that d_rehash() call from it, 269 476 650 and 750 > complete without locking up. And when I remove the WARN_ON()s > inserted for 2) and 3), then they pass. > > You are very much on the right lines! Well, more than that: it's exactly the right thing to do, isn't it? shmem_mknod() already called d_make_peristent() which called __d_rehash(), calling it a second time naturally leads to the __d_lookup() lockup seen. And I can't see a place now for shmem_whiteout()'s "Cheat and hash" comment. Al, may I please leave you to send in the fix to Christian and/or Linus? You may have noticed other things on the way, that you might want to add. But if your patch resembles the below (which has now passed xfstests auto runs on tmpfs), please feel free to add or omit any or all of Reported-by: Hugh Dickins Acked-by: Hugh Dickins Tested-by: Hugh Dickins Thanks a lot for your very quick resolution! Hugh --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4023,18 +4023,7 @@ static int shmem_whiteout(struct mnt_idmap *idmap, error = shmem_mknod(idmap, old_dir, whiteout, S_IFCHR | WHITEOUT_MODE, WHITEOUT_DEV); dput(whiteout); - if (error) - return error; - - /* - * Cheat and hash the whiteout while the old dentry is still in - * place, instead of playing games with FS_RENAME_DOES_D_MOVE. - * - * d_lookup() will consistently find one of them at this point, - * not sure which one, but that isn't even important. - */ - d_rehash(whiteout); - return 0; + return error; } /*