Resent-Date: Tue, 16 Feb 1999 07:32:57 +0100 (MET)
Date: Tue, 16 Feb 1999 00:32:33 -0600
From: Chris Lawrence <quango@watervalley.net>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux/m68k Mailing List <linux-m68k@lists.linux-m68k.org>,
        linux-kernel@vger.rutgers.edu
Subject: 2.2.1: fs/buffer.c::fdatasync patch
Mail-Followup-To: Linus Torvalds <torvalds@transmeta.com>,
	Linux/m68k Mailing List <linux-m68k@lists.linux-m68k.org>,
	linux-kernel@vger.rutgers.edu
Organization: Kathie Lee's Sweatshops
X-Operating-System: Linux/i486 2.2.1
Resent-From: linux-m68k@phil.uni-sb.de

The following patch implements a semaphore in fsync() that should also
have been propogated to the (identical) fdatasync() function; perhaps
fdatasync() should just call fsync() until fdatasync() is properly
implemented on its own... anyway, here's the fix.


Chris
-- 
=============================================================================
|       Chris Lawrence       |   You have a computer.  Do you have Linux?   |
|  <quango@watervalley.net>  |     http://www.linux-m68k.org/index.html     |
|                            |                                              |
|    Amiga A4000/060 with    |         Visit the Amiga Web Directory        |
|     Linux/m68k 2.1.127     |        http://www.cucug.org/amiga.html       |
=============================================================================

--- linux-2.2.1/fs/buffer.c	Fri Jan 22 22:32:04 1999
+++ linux/fs/buffer.c	Tue Feb 16 00:16:32 1999
@@ -382,8 +382,11 @@
 	if (!file->f_op || !file->f_op->fsync)
 		goto out_putf;
 
+	/* We need to protect against concurrent writers.. */
+	down(&inode->i_sem);
 	/* this needs further work, at the moment it is identical to fsync() */
 	err = file->f_op->fsync(file, dentry);
+	up(&inode->i_sem);
 
 out_putf:
 	fput(file);

