Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFS: Enable use of the RWF_DONTCACHE flag on the NFS client

The NFS client needs to defer dropbehind until after any writes to the
folio have been persisted on the server. Since this may be a 2 step
process, use folio_end_writeback_no_dropbehind() to allow release of the
writeback flag, and then call folio_end_dropbehind() once the COMMIT is
done.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>

authored by

Trond Myklebust and committed by
Anna Schumaker
902893e3 010054a5

+9 -5
+5 -4
fs/nfs/file.c
··· 363 363 364 364 if (pnfs_ld_read_whole_page(file_inode(file))) 365 365 return true; 366 + if (folio_test_dropbehind(folio)) 367 + return false; 366 368 /* Open for reading too? */ 367 369 if (file->f_mode & FMODE_READ) 368 370 return true; ··· 384 382 loff_t pos, unsigned len, struct folio **foliop, 385 383 void **fsdata) 386 384 { 387 - fgf_t fgp = FGP_WRITEBEGIN; 388 385 struct folio *folio; 389 386 struct file *file = iocb->ki_filp; 390 387 int once_thru = 0; ··· 395 394 file, mapping->host->i_ino, len, (long long) pos); 396 395 nfs_truncate_last_folio(mapping, i_size_read(mapping->host), pos); 397 396 398 - fgp |= fgf_set_order(len); 399 397 start: 400 - folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp, 401 - mapping_gfp_mask(mapping)); 398 + folio = write_begin_get_folio(iocb, mapping, pos >> PAGE_SHIFT, len); 402 399 if (IS_ERR(folio)) { 403 400 ret = PTR_ERR(folio); 404 401 goto out; ··· 410 411 } else if (!once_thru && 411 412 nfs_want_read_modify_write(file, folio, pos, len)) { 412 413 once_thru = 1; 414 + folio_clear_dropbehind(folio); 413 415 ret = nfs_read_folio(file, folio); 414 416 folio_put(folio); 415 417 if (!ret) ··· 963 963 .splice_write = iter_file_splice_write, 964 964 .check_flags = nfs_check_flags, 965 965 .setlease = simple_nosetlease, 966 + .fop_flags = FOP_DONTCACHE, 966 967 }; 967 968 EXPORT_SYMBOL_GPL(nfs_file_operations);
+1
fs/nfs/nfs4file.c
··· 456 456 #else 457 457 .llseek = nfs_file_llseek, 458 458 #endif 459 + .fop_flags = FOP_DONTCACHE, 459 460 };
+3 -1
fs/nfs/write.c
··· 296 296 { 297 297 struct nfs_server *nfss = NFS_SERVER(folio->mapping->host); 298 298 299 - folio_end_writeback(folio); 299 + folio_end_writeback_no_dropbehind(folio); 300 300 if (atomic_long_dec_return(&nfss->writeback) < 301 301 NFS_CONGESTION_OFF_THRESH) { 302 302 nfss->write_congested = 0; ··· 748 748 clear_bit(PG_MAPPED, &req->wb_head->wb_flags); 749 749 } 750 750 spin_unlock(&mapping->i_private_lock); 751 + 752 + folio_end_dropbehind(folio); 751 753 } 752 754 nfs_page_group_unlock(req); 753 755