mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tmenninger@purestorage.com
To: trondmy@kernel.org
Cc: anna@kernel.org, jlayton@kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, jcurley@everpuredata.com,
	Tim Menninger <tmenninger@everpuredata.com>,
	stable@vger.kernel.org
Subject: [PATCH v2] pNFS: Fix EBUSY check in pnfs_layout_need_return
Date: Wed, 19 Aug 2026 12:41:21 +0000	[thread overview]
Message-ID: <20260819124121.1587969-1-tmenninger@purestorage.com> (raw)
In-Reply-To: <ee8f174933d00fc58e2f54fd2fdd98d67919884b.camel@kernel.org>

From: Tim Menninger <tmenninger@everpuredata.com>

Commit 41d0a8ead9720 ("NFSv4/pnfs: Add support for the
PNFS_LAYOUT_FILE_BULK_RETURN flag") replaced
pnfs_layout_segments_returnable() in pnfs_layout_need_return() with a
direct call to pnfs_mark_layout_stateid_return().

The old helper checked the return value against -EBUSY, but the
replacement compares against EBUSY. Since
pnfs_mark_layout_stateid_return() returns negative errno values, the
-EBUSY case is never detected.

Fix the comparison in pnfs_layout_need_return() to check against -EBUSY.

Fixes: 41d0a8ead9720 ("NFSv4/pnfs: Add support for the PNFS_LAYOUT_FILE_BULK_RETURN flag")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
---
v1 -> v2:
- Preserve the -ENOENT path so the client can respond to recalls when it
  no longer holds matching layout segments, as pointed out by Trond.
- Defer only on -EBUSY instead of requiring a zero return value.

v1: https://lore.kernel.org/all/20260817154044.1799634-1-tmenninger@purestorage.com/

 fs/nfs/pnfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 9f32dd7c4c63..594350f4ed2d 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1389,7 +1389,7 @@ pnfs_layout_need_return(struct pnfs_layout_hdr *lo)
 		return false;
 	return pnfs_mark_layout_stateid_return(lo, &lo->plh_return_segs,
 					       lo->plh_return_iomode,
-					       lo->plh_return_seq) != EBUSY;
+					       lo->plh_return_seq) != -EBUSY;
 }
 
 static void pnfs_layoutreturn_before_put_layout_hdr(struct pnfs_layout_hdr *lo)
-- 
2.34.1


      reply	other threads:[~2026-08-19 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 15:40 [PATCH] " tmenninger
2026-08-18 18:24 ` Trond Myklebust
2026-08-19 12:41   ` tmenninger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260819124121.1587969-1-tmenninger@purestorage.com \
    --to=tmenninger@purestorage.com \
    --cc=anna@kernel.org \
    --cc=jcurley@everpuredata.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmenninger@everpuredata.com \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®