Commit 8169d300 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull vfs fixes from Al Viro:
 "dcache fixes + kvfree() (uninlined, exported by mm/util.c) + posix_acl
  bugfix from hch"

The dcache fixes are for a subtle LRU list corruption bug reported by
Miklos Szeredi, where people inside IBM saw list corruptions with the
LTP/host01 test.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  nick kvfree() from apparmor
  posix_acl: handle NULL ACL in posix_acl_equiv_mode
  dcache: don't need rcu in shrink_dentry_list()
  more graceful recovery in umount_collect()
  don't remove from shrink list in select_collect()
  dentry_kill(): don't try to remove from shrink list
  expand the call of dentry_lru_del() in dentry_kill()
  new helper: dentry_free()
  fold try_prune_one_dentry()
  fold d_kill() and d_free()
  fix races between __d_instantiate() and checks of dentry flags
parents 256cf4c4 39f1f78d
This diff is collapsed.
...@@ -1542,7 +1542,7 @@ static inline int walk_component(struct nameidata *nd, struct path *path, ...@@ -1542,7 +1542,7 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
inode = path->dentry->d_inode; inode = path->dentry->d_inode;
} }
err = -ENOENT; err = -ENOENT;
if (!inode) if (!inode || d_is_negative(path->dentry))
goto out_path_put; goto out_path_put;
if (should_follow_link(path->dentry, follow)) { if (should_follow_link(path->dentry, follow)) {
...@@ -2249,7 +2249,7 @@ mountpoint_last(struct nameidata *nd, struct path *path) ...@@ -2249,7 +2249,7 @@ mountpoint_last(struct nameidata *nd, struct path *path)
mutex_unlock(&dir->d_inode->i_mutex); mutex_unlock(&dir->d_inode->i_mutex);
done: done:
if (!dentry->d_inode) { if (!dentry->d_inode || d_is_negative(dentry)) {
error = -ENOENT; error = -ENOENT;
dput(dentry); dput(dentry);
goto out; goto out;
...@@ -2994,7 +2994,7 @@ static int do_last(struct nameidata *nd, struct path *path, ...@@ -2994,7 +2994,7 @@ static int do_last(struct nameidata *nd, struct path *path,
finish_lookup: finish_lookup:
/* we _can_ be in RCU mode here */ /* we _can_ be in RCU mode here */
error = -ENOENT; error = -ENOENT;
if (d_is_negative(path->dentry)) { if (!inode || d_is_negative(path->dentry)) {
path_to_nameidata(path, nd); path_to_nameidata(path, nd);
goto out; goto out;
} }
......
...@@ -246,6 +246,12 @@ posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p) ...@@ -246,6 +246,12 @@ posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p)
umode_t mode = 0; umode_t mode = 0;
int not_equiv = 0; int not_equiv = 0;
/*
* A null ACL can always be presented as mode bits.
*/
if (!acl)
return 0;
FOREACH_ACL_ENTRY(pa, acl, pe) { FOREACH_ACL_ENTRY(pa, acl, pe) {
switch (pa->e_tag) { switch (pa->e_tag) {
case ACL_USER_OBJ: case ACL_USER_OBJ:
......
...@@ -221,6 +221,8 @@ struct dentry_operations { ...@@ -221,6 +221,8 @@ struct dentry_operations {
#define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */ #define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */
#define DCACHE_FILE_TYPE 0x00400000 /* Other file type */ #define DCACHE_FILE_TYPE 0x00400000 /* Other file type */
#define DCACHE_MAY_FREE 0x00800000
extern seqlock_t rename_lock; extern seqlock_t rename_lock;
static inline int dname_external(const struct dentry *dentry) static inline int dname_external(const struct dentry *dentry)
......
...@@ -370,6 +370,8 @@ static inline int is_vmalloc_or_module_addr(const void *x) ...@@ -370,6 +370,8 @@ static inline int is_vmalloc_or_module_addr(const void *x)
} }
#endif #endif
extern void kvfree(const void *addr);
static inline void compound_lock(struct page *page) static inline void compound_lock(struct page *page)
{ {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/swapops.h> #include <linux/swapops.h>
#include <linux/mman.h> #include <linux/mman.h>
#include <linux/hugetlb.h> #include <linux/hugetlb.h>
#include <linux/vmalloc.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -387,6 +388,15 @@ unsigned long vm_mmap(struct file *file, unsigned long addr, ...@@ -387,6 +388,15 @@ unsigned long vm_mmap(struct file *file, unsigned long addr,
} }
EXPORT_SYMBOL(vm_mmap); EXPORT_SYMBOL(vm_mmap);
void kvfree(const void *addr)
{
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
EXPORT_SYMBOL(kvfree);
struct address_space *page_mapping(struct page *page) struct address_space *page_mapping(struct page *page)
{ {
struct address_space *mapping = page->mapping; struct address_space *mapping = page->mapping;
......
...@@ -66,7 +66,6 @@ extern int apparmor_initialized __initdata; ...@@ -66,7 +66,6 @@ extern int apparmor_initialized __initdata;
char *aa_split_fqname(char *args, char **ns_name); char *aa_split_fqname(char *args, char **ns_name);
void aa_info_message(const char *str); void aa_info_message(const char *str);
void *__aa_kvmalloc(size_t size, gfp_t flags); void *__aa_kvmalloc(size_t size, gfp_t flags);
void kvfree(void *buffer);
static inline void *kvmalloc(size_t size) static inline void *kvmalloc(size_t size)
{ {
......
...@@ -104,17 +104,3 @@ void *__aa_kvmalloc(size_t size, gfp_t flags) ...@@ -104,17 +104,3 @@ void *__aa_kvmalloc(size_t size, gfp_t flags)
} }
return buffer; return buffer;
} }
/**
* kvfree - free an allocation do by kvmalloc
* @buffer: buffer to free (MAYBE_NULL)
*
* Free a buffer allocated by kvmalloc
*/
void kvfree(void *buffer)
{
if (is_vmalloc_addr(buffer))
vfree(buffer);
else
kfree(buffer);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment