diff options
author | John W. Linville <linville@tuxdriver.com> | 2006-06-13 15:38:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-06-13 15:38:11 -0400 |
commit | 76df73ff90e99681a99e457aec4cfe0a240b7982 (patch) | |
tree | 0a6302b1a8e5d11aeed8aa49f7e846f35aad4f5a /fs | |
parent | 5c601d0c942f5aaf7f3cff7e08f61047d70a964e (diff) | |
parent | 86bc843a268058df558844b6bf64531617fbc698 (diff) |
Merge branch 'from-linus' into upstream
Diffstat (limited to 'fs')
-rw-r--r-- | fs/debugfs/inode.c | 3 | ||||
-rw-r--r-- | fs/namei.c | 19 |
2 files changed, 12 insertions, 10 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 85d166cdcae4..b55b4ea9a676 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d | |||
67 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, | 67 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, |
68 | int mode, dev_t dev) | 68 | int mode, dev_t dev) |
69 | { | 69 | { |
70 | struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev); | 70 | struct inode *inode; |
71 | int error = -EPERM; | 71 | int error = -EPERM; |
72 | 72 | ||
73 | if (dentry->d_inode) | 73 | if (dentry->d_inode) |
74 | return -EEXIST; | 74 | return -EEXIST; |
75 | 75 | ||
76 | inode = debugfs_get_inode(dir->i_sb, mode, dev); | ||
76 | if (inode) { | 77 | if (inode) { |
77 | d_instantiate(dentry, inode); | 78 | d_instantiate(dentry, inode); |
78 | dget(dentry); | 79 | dget(dentry); |
diff --git a/fs/namei.c b/fs/namei.c index 96723ae83c89..d6e2ee251736 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1080,8 +1080,8 @@ static int fastcall do_path_lookup(int dfd, const char *name, | |||
1080 | nd->flags = flags; | 1080 | nd->flags = flags; |
1081 | nd->depth = 0; | 1081 | nd->depth = 0; |
1082 | 1082 | ||
1083 | read_lock(¤t->fs->lock); | ||
1084 | if (*name=='/') { | 1083 | if (*name=='/') { |
1084 | read_lock(¤t->fs->lock); | ||
1085 | if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) { | 1085 | if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) { |
1086 | nd->mnt = mntget(current->fs->altrootmnt); | 1086 | nd->mnt = mntget(current->fs->altrootmnt); |
1087 | nd->dentry = dget(current->fs->altroot); | 1087 | nd->dentry = dget(current->fs->altroot); |
@@ -1092,33 +1092,35 @@ static int fastcall do_path_lookup(int dfd, const char *name, | |||
1092 | } | 1092 | } |
1093 | nd->mnt = mntget(current->fs->rootmnt); | 1093 | nd->mnt = mntget(current->fs->rootmnt); |
1094 | nd->dentry = dget(current->fs->root); | 1094 | nd->dentry = dget(current->fs->root); |
1095 | read_unlock(¤t->fs->lock); | ||
1095 | } else if (dfd == AT_FDCWD) { | 1096 | } else if (dfd == AT_FDCWD) { |
1097 | read_lock(¤t->fs->lock); | ||
1096 | nd->mnt = mntget(current->fs->pwdmnt); | 1098 | nd->mnt = mntget(current->fs->pwdmnt); |
1097 | nd->dentry = dget(current->fs->pwd); | 1099 | nd->dentry = dget(current->fs->pwd); |
1100 | read_unlock(¤t->fs->lock); | ||
1098 | } else { | 1101 | } else { |
1099 | struct dentry *dentry; | 1102 | struct dentry *dentry; |
1100 | 1103 | ||
1101 | file = fget_light(dfd, &fput_needed); | 1104 | file = fget_light(dfd, &fput_needed); |
1102 | retval = -EBADF; | 1105 | retval = -EBADF; |
1103 | if (!file) | 1106 | if (!file) |
1104 | goto unlock_fail; | 1107 | goto out_fail; |
1105 | 1108 | ||
1106 | dentry = file->f_dentry; | 1109 | dentry = file->f_dentry; |
1107 | 1110 | ||
1108 | retval = -ENOTDIR; | 1111 | retval = -ENOTDIR; |
1109 | if (!S_ISDIR(dentry->d_inode->i_mode)) | 1112 | if (!S_ISDIR(dentry->d_inode->i_mode)) |
1110 | goto fput_unlock_fail; | 1113 | goto fput_fail; |
1111 | 1114 | ||
1112 | retval = file_permission(file, MAY_EXEC); | 1115 | retval = file_permission(file, MAY_EXEC); |
1113 | if (retval) | 1116 | if (retval) |
1114 | goto fput_unlock_fail; | 1117 | goto fput_fail; |
1115 | 1118 | ||
1116 | nd->mnt = mntget(file->f_vfsmnt); | 1119 | nd->mnt = mntget(file->f_vfsmnt); |
1117 | nd->dentry = dget(dentry); | 1120 | nd->dentry = dget(dentry); |
1118 | 1121 | ||
1119 | fput_light(file, fput_needed); | 1122 | fput_light(file, fput_needed); |
1120 | } | 1123 | } |
1121 | read_unlock(¤t->fs->lock); | ||
1122 | current->total_link_count = 0; | 1124 | current->total_link_count = 0; |
1123 | retval = link_path_walk(name, nd); | 1125 | retval = link_path_walk(name, nd); |
1124 | out: | 1126 | out: |
@@ -1127,13 +1129,12 @@ out: | |||
1127 | nd->dentry->d_inode)) | 1129 | nd->dentry->d_inode)) |
1128 | audit_inode(name, nd->dentry->d_inode, flags); | 1130 | audit_inode(name, nd->dentry->d_inode, flags); |
1129 | } | 1131 | } |
1132 | out_fail: | ||
1130 | return retval; | 1133 | return retval; |
1131 | 1134 | ||
1132 | fput_unlock_fail: | 1135 | fput_fail: |
1133 | fput_light(file, fput_needed); | 1136 | fput_light(file, fput_needed); |
1134 | unlock_fail: | 1137 | goto out_fail; |
1135 | read_unlock(¤t->fs->lock); | ||
1136 | return retval; | ||
1137 | } | 1138 | } |
1138 | 1139 | ||
1139 | int fastcall path_lookup(const char *name, unsigned int flags, | 1140 | int fastcall path_lookup(const char *name, unsigned int flags, |