linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] factor out common code around ->follow_link invocation
@ 2005-01-13 16:53 Christoph Hellwig
  2005-01-13 18:35 ` file system writes jenn
  2005-01-14  0:06 ` [PATCH] factor out common code around ->follow_link invocation Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Christoph Hellwig @ 2005-01-13 16:53 UTC (permalink / raw)
  To: akpm, viro; +Cc: linux-fsdevel


--- 1.116/fs/namei.c	2005-01-05 03:48:11 +01:00
+++ edited/fs/namei.c	2005-01-12 19:41:49 +01:00
@@ -481,6 +482,24 @@
 	return PTR_ERR(link);
 }
 
+static inline int __do_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+	int error;
+
+	touch_atime(nd->mnt, dentry);
+	nd_set_link(nd, NULL);
+	error = dentry->d_inode->i_op->follow_link(dentry, nd);
+	if (!error) {
+		char *s = nd_get_link(nd);
+		if (s)
+			error = __vfs_follow_link(nd, s);
+		if (dentry->d_inode->i_op->put_link)
+			dentry->d_inode->i_op->put_link(dentry, nd);
+	}
+
+	return error;
+}
+
 /*
  * This limits recursive symlink follows to 8, while
  * limiting consecutive symlinks to 40.
@@ -503,16 +522,7 @@
 	current->link_count++;
 	current->total_link_count++;
 	nd->depth++;
-	touch_atime(nd->mnt, dentry);
-	nd_set_link(nd, NULL);
-	err = dentry->d_inode->i_op->follow_link(dentry, nd);
-	if (!err) {
-		char *s = nd_get_link(nd);
-		if (s)
-			err = __vfs_follow_link(nd, s);
-		if (dentry->d_inode->i_op->put_link)
-			dentry->d_inode->i_op->put_link(dentry, nd);
-	}
+	err = __do_follow_link(dentry, nd);
 	current->link_count--;
 	nd->depth--;
 	return err;
@@ -1469,16 +1479,7 @@
 	error = security_inode_follow_link(dentry, nd);
 	if (error)
 		goto exit_dput;
-	touch_atime(nd->mnt, dentry);
-	nd_set_link(nd, NULL);
-	error = dentry->d_inode->i_op->follow_link(dentry, nd);
-	if (!error) {
-		char *s = nd_get_link(nd);
-		if (s)
-			error = __vfs_follow_link(nd, s);
-		if (dentry->d_inode->i_op->put_link)
-			dentry->d_inode->i_op->put_link(dentry, nd);
-	}
+	error = __do_follow_link(dentry, nd);
 	dput(dentry);
 	if (error)
 		return error;

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-01-14  0:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-13 16:53 [PATCH] factor out common code around ->follow_link invocation Christoph Hellwig
2005-01-13 18:35 ` file system writes jenn
2005-01-13 21:31   ` Jan Hudec
2005-01-14  0:11     ` jenn
2005-01-14  0:06 ` [PATCH] factor out common code around ->follow_link invocation Andrew Morton
2005-01-14  0:21   ` Al Viro
2005-01-14  0:34     ` Andrew Morton
2005-01-14  0:38       ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).