[PATCH 26/37] Re: [2.6-BK-URL] NTFS: 2.1.21 - Big update with race/bugfixes

From: Anton Altaparmakov
Date: Tue Oct 19 2004 - 05:26:58 EST


This is patch 26/37 in the series. It contains the following ChangeSet:

<aia21@xxxxxxxxxx> (04/10/12 1.2041.1.4)
NTFS: Provide exclusion between opening an inode / mapping an mft record
and accessing the mft record in fs/ntfs/mft.c::ntfs_mft_writepage()
by setting the page not uptodate throughout ntfs_mft_writepage().

Signed-off-by: Anton Altaparmakov <aia21@xxxxxxxxxx>

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/

===================================================================

diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog 2004-10-19 10:14:40 +01:00
+++ b/fs/ntfs/ChangeLog 2004-10-19 10:14:40 +01:00
@@ -82,6 +82,9 @@
extend the initialized size.
- Map the page instead of using page_address() before writing to it in
fs/ntfs/aops.c::ntfs_mft_writepage().
+ - Provide exclusion between opening an inode / mapping an mft record
+ and accessing the mft record in fs/ntfs/mft.c::ntfs_mft_writepage()
+ by setting the page not uptodate throughout ntfs_mft_writepage().

2.1.20 - Fix two stupid bugs introduced in 2.1.18 release.

diff -Nru a/fs/ntfs/mft.c b/fs/ntfs/mft.c
--- a/fs/ntfs/mft.c 2004-10-19 10:14:40 +01:00
+++ b/fs/ntfs/mft.c 2004-10-19 10:14:40 +01:00
@@ -724,18 +724,9 @@
*/
if (!NInoTestClearDirty(ni))
goto done;
- /* Make sure we have mapped buffers. */
- if (!page_has_buffers(page)) {
-no_buffers_err_out:
- ntfs_error(vol->sb, "Writing mft records without existing "
- "buffers is not implemented yet. %s",
- ntfs_please_email);
- err = -EOPNOTSUPP;
- goto err_out;
- }
+ BUG_ON(!page_has_buffers(page));
bh = head = page_buffers(page);
- if (!bh)
- goto no_buffers_err_out;
+ BUG_ON(!bh);
nr_bhs = 0;
block_start = 0;
m_start = ni->page_ofs;
@@ -892,6 +883,12 @@
ntfs_debug("Entering for %i inodes starting at 0x%lx.", nr, mft_no);
/* Iterate over the mft records in the page looking for a dirty one. */
maddr = (u8*)kmap(page);
+ /*
+ * Clear the page uptodate flag. This will cause anyone trying to get
+ * hold of the page to block on the page lock in read_cache_page().
+ */
+ BUG_ON(!PageUptodate(page));
+ ClearPageUptodate(page);
for (i = 0; i < nr; ++i, ++mft_no, maddr += vol->mft_record_size) {
struct inode *vi;
ntfs_inode *ni, *eni;
@@ -1034,6 +1031,7 @@
up(&ni->extent_lock);
iput(vi);
}
+ SetPageUptodate(page);
kunmap(page);
/* If a dirty mft record was found, redirty the page. */
if (is_dirty) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/