Commit 1b5a5f59 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fscache-fixes-20141013' of...

Merge tag 'fscache-fixes-20141013' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull fs-cache fixes from David Howells:
 "Two fixes for bugs in CacheFiles and a cleanup in FS-Cache"

* tag 'fscache-fixes-20141013' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
  fs/fscache/object-list.c: use __seq_open_private()
  CacheFiles: Fix incorrect test for in-memory object collision
  CacheFiles: Handle object being killed before being set up
parents b11445f8 d5d96226
...@@ -268,6 +268,12 @@ static void cachefiles_drop_object(struct fscache_object *_object) ...@@ -268,6 +268,12 @@ static void cachefiles_drop_object(struct fscache_object *_object)
ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000);
#endif #endif
/* We need to tidy the object up if we did in fact manage to open it.
* It's possible for us to get here before the object is fully
* initialised if the parent goes away or the object gets retired
* before we set it up.
*/
if (object->dentry) {
/* delete retired objects */ /* delete retired objects */
if (test_bit(FSCACHE_OBJECT_RETIRED, &object->fscache.flags) && if (test_bit(FSCACHE_OBJECT_RETIRED, &object->fscache.flags) &&
_object != cache->cache.fsdef _object != cache->cache.fsdef
...@@ -282,6 +288,7 @@ static void cachefiles_drop_object(struct fscache_object *_object) ...@@ -282,6 +288,7 @@ static void cachefiles_drop_object(struct fscache_object *_object)
if (object->backer != object->dentry) if (object->backer != object->dentry)
dput(object->backer); dput(object->backer);
object->backer = NULL; object->backer = NULL;
}
/* note that the object is now inactive */ /* note that the object is now inactive */
if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) { if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) {
......
...@@ -189,7 +189,7 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache, ...@@ -189,7 +189,7 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
/* an old object from a previous incarnation is hogging the slot - we /* an old object from a previous incarnation is hogging the slot - we
* need to wait for it to be destroyed */ * need to wait for it to be destroyed */
wait_for_old_object: wait_for_old_object:
if (fscache_object_is_live(&object->fscache)) { if (fscache_object_is_live(&xobject->fscache)) {
pr_err("\n"); pr_err("\n");
pr_err("Error: Unexpected object collision\n"); pr_err("Error: Unexpected object collision\n");
cachefiles_printk_object(object, xobject); cachefiles_printk_object(object, xobject);
......
...@@ -380,26 +380,14 @@ static void fscache_objlist_config(struct fscache_objlist_data *data) ...@@ -380,26 +380,14 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
static int fscache_objlist_open(struct inode *inode, struct file *file) static int fscache_objlist_open(struct inode *inode, struct file *file)
{ {
struct fscache_objlist_data *data; struct fscache_objlist_data *data;
struct seq_file *m;
int ret;
ret = seq_open(file, &fscache_objlist_ops); data = __seq_open_private(file, &fscache_objlist_ops, sizeof(*data));
if (ret < 0) if (!data)
return ret;
m = file->private_data;
/* buffer for key extraction */
data = kmalloc(sizeof(struct fscache_objlist_data), GFP_KERNEL);
if (!data) {
seq_release(inode, file);
return -ENOMEM; return -ENOMEM;
}
/* get the configuration key */ /* get the configuration key */
fscache_objlist_config(data); fscache_objlist_config(data);
m->private = data;
return 0; return 0;
} }
......
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