Re: [PATCH] 9p: fix WARN_ON when dropping nlink on files with nlink=0

From: Dominique Martinet

Date: Mon Apr 20 2026 - 13:47:32 EST


Breno Leitao wrote on Mon, Apr 20, 2026 at 07:31:14AM -0700:
> In cacheless mode the server is authoritative and the inode is on its
> way out, so locally adjusting nlink buys nothing. Skip v9fs_dec_count()
> entirely when neither CACHE_META nor CACHE_LOOSE is set, which both
> avoids the warning and removes a class of nlink races (two concurrent
> unlinkers observing nlink > 0 and both calling drop_nlink()) that an
> nlink == 0 guard alone would only narrow rather than close.

I need to check this doesn't actually leak memory or something but this
sounds better to me, thanks.

Please send as a proper PATCH mail and I'll tentatively apply for 7.2
(a bit too late for 7.1)

--
Dominique Martinet | Asmadeus