aboutsummaryrefslogtreecommitdiffstats
diff options
authorMike Marshall <hubcap@omnibond.com>2025-05-13 20:17:45 -0400
committerMike Marshall <hubcap@omnibond.com>2025-05-20 11:07:00 -0400
commit219bf6edd7efcea9eca53c44c8dc3d1c6437f8b8 (patch)
treec14ad9a7f27c5aa04009a802887e8c50f1f7c2c4
parent82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3 (diff)
downloadlinux-counting-fix.tar.gz
orangefs: adjust counting code to recover from 665575cffor-linus-6.15-ofs2counting-fix
A late commit to 6.14-rc7! broke orangefs. 665575cf seems like a good change, but maybe should have been introduced during the merge window. This patch adjusts the counting code associated with writing out pages so that orangefs works in a 665575cf world. Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r--fs/orangefs/inode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 5ac743c6bc2ed5..08a6f372a352f8 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -32,12 +32,13 @@ static int orangefs_writepage_locked(struct folio *folio,
len = i_size_read(inode);
if (folio->private) {
wr = folio->private;
- 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 = folio_pos(folio);
@@ -46,8 +47,6 @@ static int orangefs_writepage_locked(struct folio *folio,
if (wlen > len - off)
wlen = len - off;
}
- /* Should've been handled in orangefs_invalidate_folio. */
- WARN_ON(off == len || off + wlen > len);
WARN_ON(wlen == 0);
bvec_set_folio(&bv, folio, wlen, offset_in_folio(folio, off));
@@ -320,6 +319,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;