History

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

Linus Torvalds committed 13 years ago

Commit 4d4323e2 parents 8495e9c 52e220d8 files · +17 −19Browse files

Unified · Split

8 files
  1. fs/bfs/inode.c +1 −1
  2. fs/dcache.c +11 −0
  3. fs/efs/inode.c +1 −1
  4. fs/hugetlbfs/inode.c +1 −7
  5. fs/namespace.c +1 −1
  6. fs/proc/fd.c +0 −2
  7. include/linux/dcache.h +1 −0
  8. mm/shmem.c +1 −7
fs/bfs/inode.c+1−1
@@ -40,7 +40,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino) · 39 unmodified lines
4040 int block, off;
4141
4242 inode = iget_locked(sb, ino);
43− if (IS_ERR(inode))
43+ if (!inode)
4444 return ERR_PTR(-ENOMEM);
4545 if (!(inode->i_state & I_NEW))
4646 return inode;
fs/dcache.c+11−0
@@ -2724,6 +2724,17 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen, · 2723 unmodified lines
27242724 return memcpy(buffer, temp, sz);
27252725 }
27262726
2727+char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
2728+{
2729+ char *end = buffer + buflen;
2730+ /* these dentries are never renamed, so d_lock is not needed */
2731+ if (prepend(&end, &buflen, " (deleted)", 11) ||
2732+ prepend_name(&end, &buflen, &dentry->d_name) ||
2733+ prepend(&end, &buflen, "/", 1))
2734+ end = ERR_PTR(-ENAMETOOLONG);
2735+ return end;
2736+}
2737+
27272738 /*
27282739 * Write full pathname from the root of the filesystem into the buffer.
27292740 */
fs/efs/inode.c+1−1
@@ -57,7 +57,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino) · 56 unmodified lines
5757 struct inode *inode;
5858
5959 inode = iget_locked(super, ino);
60− if (IS_ERR(inode))
60+ if (!inode)
6161 return ERR_PTR(-ENOMEM);
6262 if (!(inode->i_state & I_NEW))
6363 return inode;
fs/hugetlbfs/inode.c+1−7
@@ -926,14 +926,8 @@ static int get_hstate_idx(int page_size_log) · 925 unmodified lines
926926 return h - hstates;
927927 }
928928
929−static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen)
930−{
931− return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
932− dentry->d_name.name);
933−}
934−
935929 static struct dentry_operations anon_ops = {
936− .d_dname = hugetlb_dname
930+ .d_dname = simple_dname
937931 };
938932
939933 /*
fs/namespace.c+1−1
@@ -1429,7 +1429,7 @@ struct vfsmount *collect_mounts(struct path *path) · 1428 unmodified lines
14291429 CL_COPY_ALL | CL_PRIVATE);
14301430 namespace_unlock();
14311431 if (IS_ERR(tree))
1432− return NULL;
1432+ return ERR_CAST(tree);
14331433 return &tree->mnt;
14341434 }
14351435
fs/proc/fd.c+0−2
@@ -228,8 +228,6 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx, · 227 unmodified lines
228228 if (!p)
229229 return -ENOENT;
230230
231− if (!dir_emit_dots(file, ctx))
232− goto out;
233231 if (!dir_emit_dots(file, ctx))
234232 goto out;
235233 files = get_files_struct(p);
include/linux/dcache.h+1−0
@@ -336,6 +336,7 @@ extern int d_validate(struct dentry *, struct dentry *); · 335 unmodified lines
336336 * helper function for dentry_operations.d_dname() members
337337 */
338338 extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
339+extern char *simple_dname(struct dentry *, char *, int);
339340
340341 extern char *__d_path(const struct path *, const struct path *, char *, int);
341342 extern char *d_absolute_path(const struct path *, char *, int);
mm/shmem.c+1−7
@@ -2909,14 +2909,8 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); · 2908 unmodified lines
29092909
29102910 /* common code */
29112911
2912−static char *shmem_dname(struct dentry *dentry, char *buffer, int buflen)
2913−{
2914− return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
2915− dentry->d_name.name);
2916−}
2917−
29182912 static struct dentry_operations anon_ops = {
2919− .d_dname = shmem_dname
2913+ .d_dname = simple_dname
29202914 };
29212915
29222916 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t