From: Suparna Bhattacharya <suparna@in.ibm.com>




 mm/filemap.c |   13 +++++++++++++
 1 files changed, 13 insertions(+)

diff -puN mm/filemap.c~O_DIRECT-race-fixes-commentary mm/filemap.c
--- 25/mm/filemap.c~O_DIRECT-race-fixes-commentary	2003-09-18 22:19:35.000000000 -0700
+++ 25-akpm/mm/filemap.c	2003-09-18 22:19:35.000000000 -0700
@@ -1760,6 +1760,9 @@ EXPORT_SYMBOL(generic_write_checks);
 
 /*
  * Write to a file through the page cache. 
+ * Should be called with the following semaphores already held:
+ * 	i_alloc_sem (only for O_DIRECT writes to regular files)
+ * 	i_sem (only for regular files)
  *
  * We put everything into the page cache prior to writing it. This is not a
  * problem when writing full pages. With partial pages, however, we first have
@@ -1973,6 +1976,11 @@ out:
 	return err;
 }
 
+/*
+ * Should be called with the following semaphores already held:
+ * 	i_alloc_sem (only for O_DIRECT writes to regular files)
+ * 	i_sem (only for regular files)
+ */
 ssize_t
 generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
 				unsigned long nr_segs, loff_t *ppos)
@@ -2022,6 +2030,11 @@ __generic_file_write_nolock(struct file 
 	return ret;
 }
 
+/*
+ * Should be called with the following semaphores already held:
+ * 	i_alloc_sem (only for O_DIRECT writes to regular files)
+ * 	i_sem (only for regular files)
+ */
 ssize_t
 generic_file_write_nolock(struct file *file, const struct iovec *iov,
 				unsigned long nr_segs, loff_t *ppos)

_