提交 4d4323ea 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "Assorted fixes from the last week or so"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  VFS: collect_mounts() should return an ERR_PTR
  bfs: iget_locked() doesn't return an ERR_PTR
  efs: iget_locked() doesn't return an ERR_PTR()
  proc: kill the extra proc_readfd_common()->dir_emit_dots()
  cope with potentially long ->d_dname() output for shmem/hugetlb
...@@ -40,7 +40,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino) ...@@ -40,7 +40,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
int block, off; int block, off;
inode = iget_locked(sb, ino); inode = iget_locked(sb, ino);
if (IS_ERR(inode)) if (!inode)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW)) if (!(inode->i_state & I_NEW))
return inode; return inode;
......
...@@ -2724,6 +2724,17 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen, ...@@ -2724,6 +2724,17 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen,
return memcpy(buffer, temp, sz); return memcpy(buffer, temp, sz);
} }
char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
{
char *end = buffer + buflen;
/* these dentries are never renamed, so d_lock is not needed */
if (prepend(&end, &buflen, " (deleted)", 11) ||
prepend_name(&end, &buflen, &dentry->d_name) ||
prepend(&end, &buflen, "/", 1))
end = ERR_PTR(-ENAMETOOLONG);
return end;
}
/* /*
* Write full pathname from the root of the filesystem into the buffer. * Write full pathname from the root of the filesystem into the buffer.
*/ */
......
...@@ -57,7 +57,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino) ...@@ -57,7 +57,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
struct inode *inode; struct inode *inode;
inode = iget_locked(super, ino); inode = iget_locked(super, ino);
if (IS_ERR(inode)) if (!inode)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW)) if (!(inode->i_state & I_NEW))
return inode; return inode;
......
...@@ -926,14 +926,8 @@ static int get_hstate_idx(int page_size_log) ...@@ -926,14 +926,8 @@ static int get_hstate_idx(int page_size_log)
return h - hstates; return h - hstates;
} }
static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen)
{
return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
dentry->d_name.name);
}
static struct dentry_operations anon_ops = { static struct dentry_operations anon_ops = {
.d_dname = hugetlb_dname .d_dname = simple_dname
}; };
/* /*
......
...@@ -1429,7 +1429,7 @@ struct vfsmount *collect_mounts(struct path *path) ...@@ -1429,7 +1429,7 @@ struct vfsmount *collect_mounts(struct path *path)
CL_COPY_ALL | CL_PRIVATE); CL_COPY_ALL | CL_PRIVATE);
namespace_unlock(); namespace_unlock();
if (IS_ERR(tree)) if (IS_ERR(tree))
return NULL; return ERR_CAST(tree);
return &tree->mnt; return &tree->mnt;
} }
......
...@@ -228,8 +228,6 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx, ...@@ -228,8 +228,6 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx,
if (!p) if (!p)
return -ENOENT; return -ENOENT;
if (!dir_emit_dots(file, ctx))
goto out;
if (!dir_emit_dots(file, ctx)) if (!dir_emit_dots(file, ctx))
goto out; goto out;
files = get_files_struct(p); files = get_files_struct(p);
......
...@@ -336,6 +336,7 @@ extern int d_validate(struct dentry *, struct dentry *); ...@@ -336,6 +336,7 @@ extern int d_validate(struct dentry *, struct dentry *);
* helper function for dentry_operations.d_dname() members * helper function for dentry_operations.d_dname() members
*/ */
extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
extern char *simple_dname(struct dentry *, char *, int);
extern char *__d_path(const struct path *, const struct path *, char *, int); extern char *__d_path(const struct path *, const struct path *, char *, int);
extern char *d_absolute_path(const struct path *, char *, int); extern char *d_absolute_path(const struct path *, char *, int);
......
...@@ -2909,14 +2909,8 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); ...@@ -2909,14 +2909,8 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
/* common code */ /* common code */
static char *shmem_dname(struct dentry *dentry, char *buffer, int buflen)
{
return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
dentry->d_name.name);
}
static struct dentry_operations anon_ops = { static struct dentry_operations anon_ops = {
.d_dname = shmem_dname .d_dname = simple_dname
}; };
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册