
From: Vladimir Saveliev <vs@namesys.com>

This patch fixes a bug which might be hit on inode access time update.

Signed-off-by: Vladimir Saveliev <vs@namesys.com>


 fs/reiser4/plugin/file/file.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff -puN fs/reiser4/plugin/file/file.c~reiser4-atime-update-fix fs/reiser4/plugin/file/file.c
--- linux-2.6.14-rc1-mm1/fs/reiser4/plugin/file/file.c~reiser4-atime-update-fix	2005-09-16 18:36:49.134506700 +0400
+++ linux-2.6.14-rc1-mm1-vs/fs/reiser4/plugin/file/file.c	2005-09-16 18:36:49.154511923 +0400
@@ -1947,14 +1947,6 @@ read_unix_file(struct file *file, char _
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
 
-	needed = unix_file_estimate_read(inode, read_amount);
-	result = reiser4_grab_space(needed, BA_CAN_COMMIT);
-	if (result != 0) {
-		context_set_commit_async(ctx);
-		reiser4_exit_context(ctx);
-		return result;
-	}
-
 	hint = kmalloc(sizeof(*hint), GFP_KERNEL);
 	if (hint == NULL) {
 		context_set_commit_async(ctx);
@@ -2043,8 +2035,16 @@ read_unix_file(struct file *file, char _
 	kfree(hint);
 
 	if (count) {
-		/* something was read. Update inode's atime and stat data */
-		update_atime(inode);
+		/*
+		 * something was read. Grab space for stat data update and
+		 * update atime
+		 */
+		needed = unix_file_estimate_read(inode, read_amount);
+		result = reiser4_grab_space_force(needed, BA_CAN_COMMIT);
+		if (result == 0)
+			update_atime(inode);
+		else
+			warning("", "failed to grab space for atime update");
 	}
 
 	context_set_commit_async(ctx);

_
