Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of empty ntfs file leads to D state hang

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Anton Altaparmakov <aia21@...>
Cc: LKML <linux-kernel@...>, <linux-ntfs-dev@...>, Neil Brown <neilb@...>
Date: Tuesday, October 30, 2007 - 4:00 am

On Mon, 2007-10-29 at 16:18 +0100, Mike Galbraith wrote:

Not being very good at walking away from unsolved mysteries, I chased it
down.  The problem is that...
	commit[a32ea1e1f925399e0d81ca3f7394a44a6dafa12c] Fix read/truncate race
...calls ntfs_readpage() for a zero i_size inode, which it isn't
accustomed to.

Below is the hammer which made my box a happy camper again.

diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 6e5c253..ddab5a3 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -401,7 +401,7 @@ static int ntfs_readpage(struct file *file, struct page *page)
 	MFT_RECORD *mrec;
 	unsigned long flags;
 	u32 attr_len;
-	int err = 0;
+	int err = 0, once = 0;
 
 retry_readpage:
 	BUG_ON(!PageLocked(page));
@@ -414,6 +414,18 @@ retry_readpage:
 		return 0;
 	}
 	vi = page->mapping->host;
+	/*
+	 * If we've been called to read a zero sized inode, zero and bail.
+	 */
+	if (!once) {
+		loff_t i_size = i_size_read(vi);
+
+		once++;
+		if (!i_size) {
+			zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
+			goto done;
+		}
+	}
 	ni = NTFS_I(vi);
 	/*
 	 * Only $DATA attributes can be encrypted and only unnamed $DATA


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Anton Altaparmakov, (Mon Oct 29, 6:31 am)
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Anton Altaparmakov, (Mon Oct 29, 9:39 am)
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Mike Galbraith, (Tue Oct 30, 4:00 am)
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Anton Altaparmakov, (Tue Oct 30, 5:23 am)
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Anton Altaparmakov, (Fri Nov 2, 3:22 pm)
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Anton Altaparmakov, (Sat Nov 3, 3:27 am)
Re: [Linux-NTFS-Dev] 2.6.23 regression: second access of emp..., Anton Altaparmakov, (Mon Oct 29, 9:41 am)
Re: 2.6.23 regression: second access of empty ntfs file lead..., Anton Altaparmakov, (Mon Oct 29, 6:40 am)