aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/direct.c4
-rw-r--r--fs/nfs/write.c7
-rw-r--r--include/linux/nfs_xdr.h2
3 files changed, 8 insertions, 5 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 23d170bc44f4..b5385a7efd56 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -710,12 +710,12 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
710 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) 710 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
711 bit = NFS_IOHDR_NEED_RESCHED; 711 bit = NFS_IOHDR_NEED_RESCHED;
712 else if (dreq->flags == 0) { 712 else if (dreq->flags == 0) {
713 memcpy(&dreq->verf, &req->wb_verf, 713 memcpy(&dreq->verf, hdr->verf,
714 sizeof(dreq->verf)); 714 sizeof(dreq->verf));
715 bit = NFS_IOHDR_NEED_COMMIT; 715 bit = NFS_IOHDR_NEED_COMMIT;
716 dreq->flags = NFS_ODIRECT_DO_COMMIT; 716 dreq->flags = NFS_ODIRECT_DO_COMMIT;
717 } else if (dreq->flags == NFS_ODIRECT_DO_COMMIT) { 717 } else if (dreq->flags == NFS_ODIRECT_DO_COMMIT) {
718 if (memcmp(&dreq->verf, &req->wb_verf, sizeof(dreq->verf))) { 718 if (memcmp(&dreq->verf, hdr->verf, sizeof(dreq->verf))) {
719 dreq->flags = NFS_ODIRECT_RESCHED_WRITES; 719 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
720 bit = NFS_IOHDR_NEED_RESCHED; 720 bit = NFS_IOHDR_NEED_RESCHED;
721 } else 721 } else
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index e6fe3d69d14c..4d6861c0dc14 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -80,6 +80,7 @@ struct nfs_write_header *nfs_writehdr_alloc(void)
80 INIT_LIST_HEAD(&hdr->rpc_list); 80 INIT_LIST_HEAD(&hdr->rpc_list);
81 spin_lock_init(&hdr->lock); 81 spin_lock_init(&hdr->lock);
82 atomic_set(&hdr->refcnt, 0); 82 atomic_set(&hdr->refcnt, 0);
83 hdr->verf = &p->verf;
83 } 84 }
84 return p; 85 return p;
85} 86}
@@ -619,6 +620,7 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
619 goto next; 620 goto next;
620 } 621 }
621 if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) { 622 if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
623 memcpy(&req->wb_verf, hdr->verf, sizeof(req->wb_verf));
622 nfs_mark_request_commit(req, hdr->lseg, &cinfo); 624 nfs_mark_request_commit(req, hdr->lseg, &cinfo);
623 goto next; 625 goto next;
624 } 626 }
@@ -1255,15 +1257,14 @@ static void nfs_writeback_release_common(void *calldata)
1255 struct nfs_write_data *data = calldata; 1257 struct nfs_write_data *data = calldata;
1256 struct nfs_pgio_header *hdr = data->header; 1258 struct nfs_pgio_header *hdr = data->header;
1257 int status = data->task.tk_status; 1259 int status = data->task.tk_status;
1258 struct nfs_page *req = hdr->req;
1259 1260
1260 if ((status >= 0) && nfs_write_need_commit(data)) { 1261 if ((status >= 0) && nfs_write_need_commit(data)) {
1261 spin_lock(&hdr->lock); 1262 spin_lock(&hdr->lock);
1262 if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) 1263 if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags))
1263 ; /* Do nothing */ 1264 ; /* Do nothing */
1264 else if (!test_and_set_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) 1265 else if (!test_and_set_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags))
1265 memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf)); 1266 memcpy(hdr->verf, &data->verf, sizeof(*hdr->verf));
1266 else if (memcmp(&req->wb_verf, &data->verf, sizeof(req->wb_verf))) 1267 else if (memcmp(hdr->verf, &data->verf, sizeof(*hdr->verf)))
1267 set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags); 1268 set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags);
1268 spin_unlock(&hdr->lock); 1269 spin_unlock(&hdr->lock);
1269 } 1270 }
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 7519baef025b..8aadd90b808a 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1237,6 +1237,7 @@ struct nfs_pgio_header {
1237 struct list_head rpc_list; 1237 struct list_head rpc_list;
1238 atomic_t refcnt; 1238 atomic_t refcnt;
1239 struct nfs_page *req; 1239 struct nfs_page *req;
1240 struct nfs_writeverf *verf;
1240 struct pnfs_layout_segment *lseg; 1241 struct pnfs_layout_segment *lseg;
1241 loff_t io_start; 1242 loff_t io_start;
1242 const struct rpc_call_ops *mds_ops; 1243 const struct rpc_call_ops *mds_ops;
@@ -1274,6 +1275,7 @@ struct nfs_write_data {
1274struct nfs_write_header { 1275struct nfs_write_header {
1275 struct nfs_pgio_header header; 1276 struct nfs_pgio_header header;
1276 struct nfs_write_data rpc_data; 1277 struct nfs_write_data rpc_data;
1278 struct nfs_writeverf verf;
1277}; 1279};
1278 1280
1279struct nfs_mds_commit_info { 1281struct nfs_mds_commit_info {