From: Christoph Hellwig <hch@lst.de>
To: akpm@osdl.org, viro@parcelfarce.linux.theplanet.co.uk
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] factor out common code around ->follow_link invocation
Date: Thu, 13 Jan 2005 17:53:53 +0100 [thread overview]
Message-ID: <20050113165353.GB24377@lst.de> (raw)
--- 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;
next reply other threads:[~2005-01-13 16:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 16:53 Christoph Hellwig [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050113165353.GB24377@lst.de \
--to=hch@lst.de \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).