File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,11 @@ struct nfs_direct_req {
98
98
struct pnfs_ds_commit_info ds_cinfo ; /* Storage for cinfo */
99
99
struct work_struct work ;
100
100
int flags ;
101
+ /* for write */
101
102
#define NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */
102
103
#define NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */
104
+ /* for read */
105
+ #define NFS_ODIRECT_SHOULD_DIRTY (3) /* dirty user-space page after read */
103
106
struct nfs_writeverf verf ; /* unstable write verifier */
104
107
};
105
108
@@ -422,7 +425,8 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
422
425
struct nfs_page * req = nfs_list_entry (hdr -> pages .next );
423
426
struct page * page = req -> wb_page ;
424
427
425
- if (!PageCompound (page ) && bytes < hdr -> good_bytes )
428
+ if (!PageCompound (page ) && bytes < hdr -> good_bytes &&
429
+ (dreq -> flags == NFS_ODIRECT_SHOULD_DIRTY ))
426
430
set_page_dirty (page );
427
431
bytes += req -> wb_bytes ;
428
432
nfs_list_remove_request (req );
@@ -597,6 +601,9 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter)
597
601
if (!is_sync_kiocb (iocb ))
598
602
dreq -> iocb = iocb ;
599
603
604
+ if (iter_is_iovec (iter ))
605
+ dreq -> flags = NFS_ODIRECT_SHOULD_DIRTY ;
606
+
600
607
nfs_start_io_direct (inode );
601
608
602
609
NFS_I (inode )-> read_io += count ;
You can’t perform that action at this time.
0 commit comments