public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: hubcap@kernel.org
To: stable@vger.kernel.org
Cc: Mike Marshall <hubcap@omnibond.com>, hubcapsc@gmail.com
Subject: [PATCH 6.14] orangefs: adjust counting code to recover from 665575cf
Date: Wed,  4 Jun 2025 11:23:02 -0400	[thread overview]
Message-ID: <20250604152308.216963-2-hubcap@kernel.org> (raw)

From: Mike Marshall <hubcap@omnibond.com>

A late commit to 6.14-rc7 (665575cf) broke orangefs. This is a several line
adjustment to some counters needed to keep orangefs from deadlocking
when writing page cache data out to the filesystem. 

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
---
 fs/orangefs/inode.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index aae6d2b8767d..3e8ce0fea4d7 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -32,12 +32,13 @@ static int orangefs_writepage_locked(struct page *page,
 	len = i_size_read(inode);
 	if (PagePrivate(page)) {
 		wr = (struct orangefs_write_range *)page_private(page);
-		WARN_ON(wr->pos >= len);
 		off = wr->pos;
-		if (off + wr->len > len)
+		if ((off + wr->len > len) && (off <= len))
 			wlen = len - off;
 		else
 			wlen = wr->len;
+		if (wlen == 0)
+			wlen = wr->len;
 	} else {
 		WARN_ON(1);
 		off = page_offset(page);
@@ -46,8 +47,6 @@ static int orangefs_writepage_locked(struct page *page,
 		else
 			wlen = PAGE_SIZE;
 	}
-	/* Should've been handled in orangefs_invalidate_folio. */
-	WARN_ON(off == len || off + wlen > len);
 
 	WARN_ON(wlen == 0);
 	bvec_set_page(&bv, page, wlen, off % PAGE_SIZE);
@@ -341,6 +340,8 @@ static int orangefs_write_begin(struct file *file,
 			wr->len += len;
 			goto okay;
 		} else {
+			wr->pos = pos;
+			wr->len = len;
 			ret = orangefs_launder_folio(folio);
 			if (ret)
 				return ret;
-- 
2.49.0


             reply	other threads:[~2025-06-04 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 15:23 hubcap [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-06-04 14:34 [PATCH 6.14] orangefs: adjust counting code to recover from 665575cf hubcap
2025-06-04 14:44 ` Greg KH

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=20250604152308.216963-2-hubcap@kernel.org \
    --to=hubcap@kernel.org \
    --cc=hubcap@omnibond.com \
    --cc=hubcapsc@gmail.com \
    --cc=stable@vger.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