patch-2.3.39 linux/fs/ext2/fsync.c
Next file: linux/fs/ext2/inode.c
Previous file: linux/fs/efs/inode.c
Back to the patch index
Back to the overall index
- Lines: 32
- Date:
Sat Jan 8 12:49:25 2000
- Orig file:
v2.3.38/linux/fs/ext2/fsync.c
- Orig date:
Tue Dec 7 09:32:47 1999
diff -u --recursive --new-file v2.3.38/linux/fs/ext2/fsync.c linux/fs/ext2/fsync.c
@@ -23,6 +23,7 @@
*/
#include <linux/fs.h>
+#include <linux/locks.h>
@@ -40,10 +41,21 @@
if (!bh)
return 0;
if (wait && buffer_req(bh) && !buffer_uptodate(bh)) {
- brelse(bh);
- return -1;
+ /* There can be a parallell read(2) that started read-I/O
+ on the buffer so we can't assume that there's been
+ an I/O error without first waiting I/O completation. */
+ wait_on_buffer(bh);
+ if (!buffer_uptodate(bh))
+ {
+ brelse (bh);
+ return -1;
+ }
}
if (wait || !buffer_uptodate(bh) || !buffer_dirty(bh)) {
+ if (wait)
+ /* when we return from fsync all the blocks
+ must be _just_ stored on disk */
+ wait_on_buffer(bh);
brelse(bh);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)