From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796418898; b=r1kLeZ1Jq0CvvYjqg4BgL8F/YzinOCbVlkH0lNLbCnRh/7Fsmm46119F2tMErgoPLHXb 1DqkJ1Den/hDvd9c1KiQxwGujoscDg0ubQOs5DBNv6SkBXGyVp3kr8/90JvWJUOa1W5/C Gp0p+k0I5tc3OkmIwrDedrDdWR+/mgIsU0Cl1Re+mJdOAi9eQ25ldTNNUwHUlv3YcFFFL ayxAGqeBLdBsOpoFBB3ztoPmU/oP228gCNToBu1sCWFxgloY0JWThpkxT7F9YsoA6rcOm Q4/wBjvUw6XqDqso5peZ/P4jwhBw1wR3X0Pt8rEbgFWdYI1LN11GENdaFDeQtTJ61yw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796418898; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=WX8Dyr1VOiIqAj8wJSJ+a9zn47/VlvLOAUZWONJMzN0=; b=rzMtqCPdgV/pS0y00eonRbG5hH/Ggs9No03TbJCsQ+tAuWcvvVfCo8CH7Yjwa2K+94fN U+V6Gs6T11Ydj3x2xLhbYEkq7QWuFxgOcozD0fVP/XXB4IB+BpPSMv27TKg4YJFLv9jIG otmjGi9EbxhYM6OxGEhE4AuF4krckGv0JuUx0V3vG6IBMw71n1is2OyZ38GIsbdNRDlek +yNWrKwS1xaUmdMUSTtxxbSTcy9HRo7wg3NmKgl+Sz5khg15xD2pcuZOGrSwd4zKolQ4x R5RRHcQVY98ZgjxmyY1VK4GRLE0lsaX3PGuNUTELuSmpdcsznuQwP5CSrkEvlIksMSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Nse0L6Y8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7D4A606A322 for ; Fri, 4 Dec 2026 21:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Nse0L6Y8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29A261F00936; Fri, 4 Dec 2026 21:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796418897; bh=WX8Dyr1VOiIqAj8wJSJ+a9zn47/VlvLOAUZWONJMzN0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Nse0L6Y8SAZ4KPUuB0yBkGOzo8gBIIpcp8Ee3UMxQhMwG0JUQNpQ6eYjXSXIf5e51 5HnRfTtT54UP97TMr1BeiwibaMNDTAzRg9/htD2h5XuE/XPa6GeZQZ3dxU2e9NmTcf J5h0HPr3sjq+cBf5ap2+gwkEF+cL7YAQOeWS5rFj6e3yIXQKd04a7oeknAIM1+9+09 ApKzS0gAr3vWrHOcmpP8jUn2Nxw4jhip71slCEFWA63XSVzDln7zD25VFWGWB5/WIn IxDJyHAxtDxwjKvWptkOO1Orh1KuWUPqFNRbRP2Ck/uROa2C/xx47SAFxyYig4oJ5q IR2PKJWYZ5aiw== Date: Fri, 4 Dec 2026 16:14:56 -0500 From: Mike Snitzer To: Jeff Layton Cc: Trond Myklebust , Anna Schumaker , Mike Snitzer , Benjamin Coddington , Chuck Lever , linux-nfs@vger.kernel.org Subject: Re: NFS/localio: complete a write outside of file_start_write() Message-ID: References: <20261204-localio-freeze-v1-1-447caf7af2ca@kernel.org> X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261204-localio-freeze-v1-1-447caf7af2ca@kernel.org> On Fri, Dec 04, 2026 at 01:30:06PM -0500, Jeff Layton wrote: > nfs_local_call_write() completes the I/O while it still holds > sb_writers from file_start_write(). When the write comes up short (a > fatal signal stops generic_perform_write(), for example), the > completion restarts it: > > nfs_local_write_iocb_done > nfs_local_pgio_release > nfs_local_pgio_restart > nfs_local_do_write > nfs_local_call_write > file_start_write > > Since LOCALIO issues I/O inline outside of reclaim context, that > restarted write runs in the same task and takes sb_writers again. > Lockdep reports possible recursive locking, and if freeze_super() > starts waiting for writers in between, the second file_start_write() > blocks behind it forever. > > Drop sb_writers before completing. The restart, or the release of the > iocb, then happens with no freeze protection held. > > Fixes: da729ddd4a1bc ("NFS/localio: issue IO inline when not in a memory-reclaim context") > Signed-off-by: Jeff Layton > --- > fs/nfs/localio.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c > index 68b24872f752..cfda82ffdebb 100644 > --- a/fs/nfs/localio.c > +++ b/fs/nfs/localio.c > @@ -993,6 +993,7 @@ static void nfs_local_call_write(struct work_struct *work) > container_of(work, struct nfs_local_kiocb, work); > struct file *filp = iocb->kiocb.ki_filp; > unsigned long old_flags = current->flags; > + bool done = false; > ssize_t status; > int n_iters; > > @@ -1030,12 +1031,19 @@ static void nfs_local_call_write(struct work_struct *work) > set_bit(NFS_CONTEXT_WRITE_SYNC, > &ctx->open_context->flags); > } > - nfs_local_write_iocb_done(iocb); > + done = true; > break; > } > } > file_end_write(filp); > > + /* > + * Complete outside of file_start_write(): completion restarts a short > + * write, which can call back into this function in this same task. > + */ > + if (done) > + nfs_local_write_iocb_done(iocb); > + > current->flags = old_flags; > } > Thanks for this and the other localio delegations patchset. I'm reviewing and testing them. Will probably get back with you on Monday. Mike