Skip to contentSkip to conversation

nfsd: make sure data is on disk before calling ->fsync

PATCH In review Christoph Hellwig 2 participants 6 messages Dec 25, 2009 – Jan 6, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nfsd: make sure data is on disk before calling ->fsync

nfsd is not using vfs_fsync, so I missed it when changing the calling convention during the 2.6.32 window. This patch fixes it to not only start the data writeout, but also wait for it to complete before calling into ->fsync.

fs/nfsd/vfs.c +1 -4
Index: linux-2.6/fs/nfsd/vfs.c
===================================================================
@@ -780,12 +780,9 @@ static inline int nfsd_dosync(struct fil
 	int (*fsync) (struct file *, struct dentry *, int);
 	int err;
 
-	err = filemap_fdatawrite(inode->i_mapping);
+	err = filemap_write_and_wait(inode->i_mapping);
 	if (err == 0 && fop && (fsync = fop->fsync))
 		err = fsync(filp, dp, 0);
-	if (err == 0)
-		err = filemap_fdatawait(inode->i_mapping);
-
 	return err;
 }
 
#1 lore raw

ping? this fixes a quite nasty issue introduced in 2.6.32, so we should fix it ASAP (including backport to -stable)

Quoted 15 lines · Christoph Hellwig

nfsd is not using vfs_fsync, so I missed it when changing the calling convention during the 2.6.32 window. This patch fixes it to not only start the data writeout, but also wait for it to complete before calling into ->fsync.

Index: linux-2.6/fs/nfsd/vfs.c
===================================================================

fs/nfsd/vfs.c +0 -0
@@ -780,12 +780,9 @@ static inline int nfsd_dosync(struct fil
 	int (*fsync) (struct file *, struct dentry *, int);
 	int err;
 

fs/nfsd/vfs.c static inline int nfsd_dosync(struct fil · line 788

Quoted 10 lines
fs/nfsd/vfs.c +1 -4
-	err = filemap_fdatawrite(inode->i_mapping);
+	err = filemap_write_and_wait(inode->i_mapping);
 	if (err == 0 && fop && (fsync = fop->fsync))
 		err = fsync(filp, dp, 0);
-	if (err == 0)
-		err = filemap_fdatawait(inode->i_mapping);
-
 	return err;
 }
 

---end quoted text---

#2 lore raw
Quoted 2 lines · Christoph Hellwig

ping? this fixes a quite nasty issue introduced in 2.6.32, so we should fix it ASAP (including backport to -stable)

Apologies for the delay. Which commit exactly introduced the original regression? I'll take over getting them into 2.6.33 and 2.6.32.y unless you tell me you're already doing that.

--b.

Quoted 28 lines · Christoph Hellwig
Quoted 15 lines

nfsd is not using vfs_fsync, so I missed it when changing the calling convention during the 2.6.32 window. This patch fixes it to not only start the data writeout, but also wait for it to complete before calling into ->fsync.

Index: linux-2.6/fs/nfsd/vfs.c
===================================================================

fs/nfsd/vfs.c +0 -0
@@ -780,12 +780,9 @@ static inline int nfsd_dosync(struct fil
 	int (*fsync) (struct file *, struct dentry *, int);
 	int err;
 

fs/nfsd/vfs.c static inline int nfsd_dosync(struct fil · line 788

Quoted 10 lines
fs/nfsd/vfs.c +1 -4
-	err = filemap_fdatawrite(inode->i_mapping);
+	err = filemap_write_and_wait(inode->i_mapping);
 	if (err == 0 && fop && (fsync = fop->fsync))
 		err = fsync(filp, dp, 0);
-	if (err == 0)
-		err = filemap_fdatawait(inode->i_mapping);
-
 	return err;
 }
 

---end quoted text---

#3 lore raw
Quoted 6 lines · J. Bruce Fields
Quoted 2 lines · Christoph Hellwig

ping? this fixes a quite nasty issue introduced in 2.6.32, so we should fix it ASAP (including backport to -stable)

Apologies for the delay. Which commit exactly introduced the original regression? I'll take over getting them into 2.6.33 and 2.6.32.y

(the latter just for the first patch, I'm assuming)

Quoted 1 line

unless you tell me you're already doing that.

#4 lore raw
In reply to J. Bruce Fields
Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Christoph Hellwig

ping? this fixes a quite nasty issue introduced in 2.6.32, so we should fix it ASAP (including backport to -stable)

Apologies for the delay. Which commit exactly introduced the original regression? I'll take over getting them into 2.6.33 and 2.6.32.y unless you tell me you're already doing that.

2daea67e966dc0c42067ebea015ddac6834cef88 changed the calling convention. Removal of the explicit wait in the filesystem might have been another few commits.

If you can easily take care of getting the first patch into -stable I'll leave it to you.

#5 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · J. Bruce Fields
Quoted 2 lines · Christoph Hellwig

ping? this fixes a quite nasty issue introduced in 2.6.32, so we should fix it ASAP (including backport to -stable)

Apologies for the delay. Which commit exactly introduced the original regression? I'll take over getting them into 2.6.33 and 2.6.32.y unless you tell me you're already doing that.

Quoted 6 lines

2daea67e966dc0c42067ebea015ddac6834cef88 changed the calling convention. Removal of the explicit wait in the filesystem might have been another few commits.

If you can easily take care of getting the first patch into -stable I'll leave it to you.

OK, thanks, done. And the other patch queued up for 2.6.34.

--b.