aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/nfs4filelayout.c2
-rw-r--r--fs/nfs/pnfs.c10
-rw-r--r--fs/nfs/pnfs.h2
3 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index be93a622872c..e8915d4840ad 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -170,7 +170,7 @@ filelayout_set_layoutcommit(struct nfs_write_data *wdata)
170 170
171 pnfs_set_layoutcommit(wdata); 171 pnfs_set_layoutcommit(wdata);
172 dprintk("%s ionde %lu pls_end_pos %lu\n", __func__, wdata->inode->i_ino, 172 dprintk("%s ionde %lu pls_end_pos %lu\n", __func__, wdata->inode->i_ino,
173 (unsigned long) wdata->lseg->pls_end_pos); 173 (unsigned long) NFS_I(wdata->inode)->layout->plh_lwb);
174} 174}
175 175
176/* 176/*
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 38e5508555c6..7a948ab4e73d 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1379,9 +1379,11 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata)
1379 dprintk("%s: Set layoutcommit for inode %lu ", 1379 dprintk("%s: Set layoutcommit for inode %lu ",
1380 __func__, wdata->inode->i_ino); 1380 __func__, wdata->inode->i_ino);
1381 } 1381 }
1382 if (end_pos > wdata->lseg->pls_end_pos) 1382 if (end_pos > nfsi->layout->plh_lwb)
1383 wdata->lseg->pls_end_pos = end_pos; 1383 nfsi->layout->plh_lwb = end_pos;
1384 spin_unlock(&nfsi->vfs_inode.i_lock); 1384 spin_unlock(&nfsi->vfs_inode.i_lock);
1385 dprintk("%s: lseg %p end_pos %llu\n",
1386 __func__, wdata->lseg, nfsi->layout->plh_lwb);
1385 1387
1386 /* if pnfs_layoutcommit_inode() runs between inode locks, the next one 1388 /* if pnfs_layoutcommit_inode() runs between inode locks, the next one
1387 * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */ 1389 * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */
@@ -1433,9 +1435,9 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
1433 */ 1435 */
1434 lseg = pnfs_list_write_lseg(inode); 1436 lseg = pnfs_list_write_lseg(inode);
1435 1437
1436 end_pos = lseg->pls_end_pos; 1438 end_pos = nfsi->layout->plh_lwb;
1437 cred = lseg->pls_lc_cred; 1439 cred = lseg->pls_lc_cred;
1438 lseg->pls_end_pos = 0; 1440 nfsi->layout->plh_lwb = 0;
1439 lseg->pls_lc_cred = NULL; 1441 lseg->pls_lc_cred = NULL;
1440 1442
1441 memcpy(&data->args.stateid.data, nfsi->layout->plh_stateid.data, 1443 memcpy(&data->args.stateid.data, nfsi->layout->plh_stateid.data,
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 078670dfbe04..1eb2c043d23a 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -45,7 +45,6 @@ struct pnfs_layout_segment {
45 unsigned long pls_flags; 45 unsigned long pls_flags;
46 struct pnfs_layout_hdr *pls_layout; 46 struct pnfs_layout_hdr *pls_layout;
47 struct rpc_cred *pls_lc_cred; /* LAYOUTCOMMIT credential */ 47 struct rpc_cred *pls_lc_cred; /* LAYOUTCOMMIT credential */
48 loff_t pls_end_pos; /* LAYOUTCOMMIT write end */
49}; 48};
50 49
51enum pnfs_try_status { 50enum pnfs_try_status {
@@ -125,6 +124,7 @@ struct pnfs_layout_hdr {
125 unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ 124 unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */
126 u32 plh_barrier; /* ignore lower seqids */ 125 u32 plh_barrier; /* ignore lower seqids */
127 unsigned long plh_flags; 126 unsigned long plh_flags;
127 loff_t plh_lwb; /* last write byte for layoutcommit */
128 struct inode *plh_inode; 128 struct inode *plh_inode;
129}; 129};
130 130