aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/objlayout/objio_osd.c3
-rw-r--r--fs/nfs/pnfs.c12
-rw-r--r--fs/nfs/pnfs.h1
3 files changed, 15 insertions, 1 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index c807ab93140e..55d01280a609 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -551,7 +551,8 @@ static const struct nfs_pageio_ops objio_pg_write_ops = {
551static struct pnfs_layoutdriver_type objlayout_type = { 551static struct pnfs_layoutdriver_type objlayout_type = {
552 .id = LAYOUT_OSD2_OBJECTS, 552 .id = LAYOUT_OSD2_OBJECTS,
553 .name = "LAYOUT_OSD2_OBJECTS", 553 .name = "LAYOUT_OSD2_OBJECTS",
554 .flags = PNFS_LAYOUTRET_ON_SETATTR, 554 .flags = PNFS_LAYOUTRET_ON_SETATTR |
555 PNFS_LAYOUTRET_ON_ERROR,
555 556
556 .alloc_layout_hdr = objlayout_alloc_layout_hdr, 557 .alloc_layout_hdr = objlayout_alloc_layout_hdr,
557 .free_layout_hdr = objlayout_free_layout_hdr, 558 .free_layout_hdr = objlayout_free_layout_hdr,
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 8e672a2b2d69..f881a6387942 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1178,6 +1178,15 @@ void pnfs_ld_write_done(struct nfs_write_data *data)
1178 put_lseg(data->lseg); 1178 put_lseg(data->lseg);
1179 data->lseg = NULL; 1179 data->lseg = NULL;
1180 dprintk("pnfs write error = %d\n", data->pnfs_error); 1180 dprintk("pnfs write error = %d\n", data->pnfs_error);
1181 if (NFS_SERVER(data->inode)->pnfs_curr_ld->flags &
1182 PNFS_LAYOUTRET_ON_ERROR) {
1183 /* Don't lo_commit on error, Server will needs to
1184 * preform a file recovery.
1185 */
1186 clear_bit(NFS_INO_LAYOUTCOMMIT,
1187 &NFS_I(data->inode)->flags);
1188 pnfs_return_layout(data->inode);
1189 }
1181 } 1190 }
1182 data->mds_ops->rpc_release(data); 1191 data->mds_ops->rpc_release(data);
1183} 1192}
@@ -1267,6 +1276,9 @@ static void pnfs_ld_handle_read_error(struct nfs_read_data *data)
1267 put_lseg(data->lseg); 1276 put_lseg(data->lseg);
1268 data->lseg = NULL; 1277 data->lseg = NULL;
1269 dprintk("pnfs write error = %d\n", data->pnfs_error); 1278 dprintk("pnfs write error = %d\n", data->pnfs_error);
1279 if (NFS_SERVER(data->inode)->pnfs_curr_ld->flags &
1280 PNFS_LAYOUTRET_ON_ERROR)
1281 pnfs_return_layout(data->inode);
1270 1282
1271 nfs_pageio_init_read_mds(&pgio, data->inode); 1283 nfs_pageio_init_read_mds(&pgio, data->inode);
1272 1284
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 1509530cb111..53d593a0a4f2 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -68,6 +68,7 @@ enum {
68enum layoutdriver_policy_flags { 68enum layoutdriver_policy_flags {
69 /* Should the pNFS client commit and return the layout upon a setattr */ 69 /* Should the pNFS client commit and return the layout upon a setattr */
70 PNFS_LAYOUTRET_ON_SETATTR = 1 << 0, 70 PNFS_LAYOUTRET_ON_SETATTR = 1 << 0,
71 PNFS_LAYOUTRET_ON_ERROR = 1 << 1,
71}; 72};
72 73
73struct nfs4_deviceid_node; 74struct nfs4_deviceid_node;