Skip to content

Commit d383e34

Browse files
committed
afs: Fix afs_launder_page to not clear PG_writeback
Fix afs_launder_page() to not clear PG_writeback on the page it is laundering as the flag isn't set in this case. Fixes: 4343d00 ("afs: Get rid of the afs_writeback record") Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 248c944 commit d383e34

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎fs/afs/internal.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ struct afs_operation {
812812
pgoff_t last; /* last page in mapping to deal with */
813813
unsigned first_offset; /* offset into mapping[first] */
814814
unsigned last_to; /* amount of mapping[last] */
815+
bool laundering; /* Laundering page, PG_writeback not set */
815816
} store;
816817
struct {
817818
struct iattr *attr;

‎fs/afs/write.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ static void afs_store_data_success(struct afs_operation *op)
396396
op->ctime = op->file[0].scb.status.mtime_client;
397397
afs_vnode_commit_status(op, &op->file[0]);
398398
if (op->error == 0) {
399-
afs_pages_written_back(vnode, op->store.first, op->store.last);
399+
if (!op->store.laundering)
400+
afs_pages_written_back(vnode, op->store.first, op->store.last);
400401
afs_stat_v(vnode, n_stores);
401402
atomic_long_add((op->store.last * PAGE_SIZE + op->store.last_to) -
402403
(op->store.first * PAGE_SIZE + op->store.first_offset),
@@ -415,7 +416,7 @@ static const struct afs_operation_ops afs_store_data_operation = {
415416
*/
416417
static int afs_store_data(struct address_space *mapping,
417418
pgoff_t first, pgoff_t last,
418-
unsigned offset, unsigned to)
419+
unsigned offset, unsigned to, bool laundering)
419420
{
420421
struct afs_vnode *vnode = AFS_FS_I(mapping->host);
421422
struct afs_operation *op;
@@ -448,6 +449,7 @@ static int afs_store_data(struct address_space *mapping,
448449
op->store.last = last;
449450
op->store.first_offset = offset;
450451
op->store.last_to = to;
452+
op->store.laundering = laundering;
451453
op->mtime = vnode->vfs_inode.i_mtime;
452454
op->flags |= AFS_OPERATION_UNINTR;
453455
op->ops = &afs_store_data_operation;
@@ -601,7 +603,7 @@ static int afs_write_back_from_locked_page(struct address_space *mapping,
601603
if (end > i_size)
602604
to = i_size & ~PAGE_MASK;
603605

604-
ret = afs_store_data(mapping, first, last, offset, to);
606+
ret = afs_store_data(mapping, first, last, offset, to, false);
605607
switch (ret) {
606608
case 0:
607609
ret = count;
@@ -921,7 +923,7 @@ int afs_launder_page(struct page *page)
921923

922924
trace_afs_page_dirty(vnode, tracepoint_string("launder"),
923925
page->index, priv);
924-
ret = afs_store_data(mapping, page->index, page->index, t, f);
926+
ret = afs_store_data(mapping, page->index, page->index, t, f, true);
925927
}
926928

927929
trace_afs_page_dirty(vnode, tracepoint_string("laundered"),

0 commit comments

Comments
 (0)