Skip to content

Commit 219bf6e

Browse files
committed
orangefs: adjust counting code to recover from 665575c
A late commit to 6.14-rc7! broke orangefs. 665575c 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 665575c world. Signed-off-by: Mike Marshall <[email protected]>
1 parent 82f2b0b commit 219bf6e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/orangefs/inode.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ static int orangefs_writepage_locked(struct folio *folio,
3232
len = i_size_read(inode);
3333
if (folio->private) {
3434
wr = folio->private;
35-
WARN_ON(wr->pos >= len);
3635
off = wr->pos;
37-
if (off + wr->len > len)
36+
if ((off + wr->len > len) && (off <= len))
3837
wlen = len - off;
3938
else
4039
wlen = wr->len;
40+
if (wlen == 0)
41+
wlen = wr->len;
4142
} else {
4243
WARN_ON(1);
4344
off = folio_pos(folio);
@@ -46,8 +47,6 @@ static int orangefs_writepage_locked(struct folio *folio,
4647
if (wlen > len - off)
4748
wlen = len - off;
4849
}
49-
/* Should've been handled in orangefs_invalidate_folio. */
50-
WARN_ON(off == len || off + wlen > len);
5150

5251
WARN_ON(wlen == 0);
5352
bvec_set_folio(&bv, folio, wlen, offset_in_folio(folio, off));
@@ -320,6 +319,8 @@ static int orangefs_write_begin(struct file *file,
320319
wr->len += len;
321320
goto okay;
322321
} else {
322+
wr->pos = pos;
323+
wr->len = len;
323324
ret = orangefs_launder_folio(folio);
324325
if (ret)
325326
return ret;

0 commit comments

Comments
 (0)