Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1103

kernel-2.6.18-238.el5.src.rpm

From: Anton Arapov <aarapov@redhat.com>
Date: Tue, 11 Nov 2008 16:04:12 +0100
Subject: [fs] link_path_walk sanity, stack usage optimization
Message-id: 20081111150411.GB9220@redhat.com
O-Subject: [RHEL5.4 PATCH] BZ470139: link_path_walk() sanity, stack usage optimization
Bugzilla: 470139
RH-Acked-by: Dave Anderson <anderson@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>
RH-Acked-by: Larry Woodman <lwoodman@redhat.com>

Bugzilla: 470139

Description:
  Subject says everything itself. Trivial patch in order to reduce
  stack usage.
  Initially was proposed to RHEL4 because Customer faced crashes due
  to kernel stack overflow.

Upstream status:
  commit# a02f76c34d7d6d30b63ac64a8b34dea68593e8da

Test status:
  this patch has been successfully tested by client on RHEL4.
  RHEL5 kernel has been tested for compilation and boot.
  https://brewweb.devel.redhat.com/taskinfo?taskID=1565591

Notice:
  RHEL4 clone: 448914
  this patch has been already reviewed and committed to RHEL4:
  http://post-office.corp.redhat.com/archives/rhkernel-list/2008-July/msg00512.html

==

diff --git a/fs/namei.c b/fs/namei.c
index bb7693c..680e491 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1014,24 +1014,26 @@ return_err:
  */
 int fastcall link_path_walk(const char *name, struct nameidata *nd)
 {
-	struct nameidata save = *nd;
+	struct dentry *saved_dentry = nd->dentry;
+	struct vfsmount *saved_mnt = nd->mnt;
 	int result;
 
 	/* make sure the stuff we saved doesn't go away */
-	dget(save.dentry);
-	mntget(save.mnt);
+	dget(saved_dentry);
+	mntget(saved_mnt);
 
 	result = __link_path_walk(name, nd);
 	if (result == -ESTALE) {
-		*nd = save;
+		nd->dentry = saved_dentry;
+		nd->mnt = saved_mnt;
 		dget(nd->dentry);
 		mntget(nd->mnt);
 		nd->flags |= LOOKUP_REVAL;
 		result = __link_path_walk(name, nd);
 	}
 
-	dput(save.dentry);
-	mntput(save.mnt);
+	dput(saved_dentry);
+	mntput(saved_mnt);
 
 	return result;
 }