Skip to contentSkip to conversation

pnfs: call layoutcommit after flushing inode's data to disk.

PATCH In review Tao Guo 3 participants 3 messages May 20, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Tao Guo

author
#0 lore raw

PATCH 1/1 pnfs: call layoutcommit after flushing inode's data to disk.

---
 fs/nfs/write.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
fs/nfs/write.c +7 -1
index d3e1645..b4f48b2 100644
@@ -1558,6 +1558,7 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
  */
 int nfs_wb_all(struct inode *inode)
 {
+	int ret;
 	struct writeback_control wbc = {
 		.sync_mode = WB_SYNC_ALL,
 		.nr_to_write = LONG_MAX,
@@ -1565,7 +1566,12 @@ int nfs_wb_all(struct inode *inode)
 		.range_end = LLONG_MAX,
 	};
 
-	return sync_inode(inode, &wbc);
+	ret = sync_inode(inode, &wbc);
+#ifdef CONFIG_NFS_V4_1
+	if (!ret && NFS_I(inode)->layoutcommit_ctx)
+		ret = pnfs_layoutcommit_inode(inode, 1);
+#endif
+	return ret;
 }
 
 int nfs_wb_page_cancel(struct inode *inode, struct page *page)
Signature · 1 line
1.6.3.3
#1 lore raw

This is for a bug introduced to 2.6.34. In 2.6.32 and 2.6.33 we call layoutcommit in
nfs_sync_mapping_wait(), but in 2.6.34 we use sync_inode() to sync inode's data, so
the layoutcommit code is gone.

BTW: In current code, layoutcommit_ctx will increase refcount of nfs_inode's ctx, so if
layoutcommit_ctx is not NULL, we could not reach nfs4_close_context =2E.. --> __nfs_close().
So pnfs_layoutcommit_inode() in __nfs_close() will not be called in whatever situation.
Why we have to use nfs_inode's ctx as layoutcommit_ctx, since we only need its rpc_creds
actually?

fs/nfs/write.c int nfs_write_inode(struct inode *inode, struct=

Quoted 10 lines · Tao Guo

---
=C2=A0fs/nfs/write.c | =C2=A0 =C2=A08 +++++++- =C2=A01 files changed, 7 insertions(+), 1 deletions(-)

fs/nfs/write.c +0 -0
index d3e1645..b4f48b2 100644
@@ -1558,6 +1558,7 @@ int nfs_write_inode(struct inode *inode, struct=

writeback_control *wbc)

Quoted 6 lines

=C2=A0*/
=C2=A0int nfs_wb_all(struct inode *inode)
=C2=A0{
+ =C2=A0 =C2=A0 =C2=A0 int ret;
=C2=A0 =C2=A0 =C2=A0 =C2=A0struct writeback_control wbc =3D { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.sync_mode =3D=

WB_SYNC_ALL,

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.nr_to_write =3D=

LONG_MAX,

Quoted 2 lines
fs/nfs/write.c +0 -0
@@ -1565,7 +1566,12 @@ int nfs_wb_all(struct inode *inode)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.range_end =3D=

LLONG_MAX,

Quoted 7 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0};

- =C2=A0 =C2=A0 =C2=A0 return sync_inode(inode, &wbc);
+ =C2=A0 =C2=A0 =C2=A0 ret =3D sync_inode(inode, &wbc); +#ifdef CONFIG_NFS_V4_1
+ =C2=A0 =C2=A0 =C2=A0 if (!ret && NFS_I(inode)->layoutcommit_ctx)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D pnfs_layou=

tcommit_inode(inode, 1);

Quoted 10 lines

+#endif
+ =C2=A0 =C2=A0 =C2=A0 return ret;
=C2=A0}

=C2=A0int nfs_wb_page_cancel(struct inode *inode, struct page *page) --
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.ht=

ml

Quoted 1 line

--=20
tao.

#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Tao Guo

This is for a bug introduced to 2.6.34. In 2.6.32 and 2.6.33 we call layoutcommit in
nfs_sync_mapping_wait(), but in 2.6.34 we use sync_inode() to sync inode's data, so
the layoutcommit code is gone.

Quoted 9 lines

BTW: In current code, layoutcommit_ctx will increase refcount of nfs_inode's ctx, so if
layoutcommit_ctx is not NULL, we could not reach nfs4_close_context ... --> __nfs_close().
So pnfs_layoutcommit_inode() in __nfs_close() will not be called in whatever situation.
Why we have to use nfs_inode's ctx as layoutcommit_ctx, since we only need its rpc_creds
actually?

I have a patch to be submitted today that replaces the nfs_open_context with an rpc_cred.

-->Andy

Quoted 51 lines · Tao Guo
Quoted 40 lines
---
 fs/nfs/write.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
fs/nfs/write.c +1 -0
index d3e1645..b4f48b2 100644
@@ -1558,6 +1558,7 @@ int nfs_write_inode(struct inode *inode,  
 struct writeback_control *wbc)
 */
 int nfs_wb_all(struct inode *inode)
 {
+       int ret;
       struct writeback_control wbc = {
               .sync_mode = WB_SYNC_ALL,

.nr_to_write = LONG_MAX,

fs/nfs/write.c +6 -2
@@ -1565,7 +1566,12 @@ int nfs_wb_all(struct inode *inode)
               .range_end = LLONG_MAX,
       };
 
-       return sync_inode(inode, &wbc);
+       ret = sync_inode(inode, &wbc);
+#ifdef CONFIG_NFS_V4_1
+       if (!ret && NFS_I(inode)->layoutcommit_ctx)
+               ret = pnfs_layoutcommit_inode(inode, 1);
+#endif
+       return ret;
 }
 
 int nfs_wb_page_cancel(struct inode *inode, struct page *page)
--

1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
tao.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html