aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cachefiles')
-rw-r--r--fs/cachefiles/interface.c13
-rw-r--r--fs/cachefiles/namei.c10
-rw-r--r--fs/cachefiles/xattr.c6
3 files changed, 17 insertions, 12 deletions
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index 746ce532e130..d4c1206af9fc 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -13,8 +13,6 @@
13#include <linux/mount.h> 13#include <linux/mount.h>
14#include "internal.h" 14#include "internal.h"
15 15
16#define list_to_page(head) (list_entry((head)->prev, struct page, lru))
17
18struct cachefiles_lookup_data { 16struct cachefiles_lookup_data {
19 struct cachefiles_xattr *auxdata; /* auxiliary data */ 17 struct cachefiles_xattr *auxdata; /* auxiliary data */
20 char *key; /* key path */ 18 char *key; /* key path */
@@ -212,20 +210,29 @@ static void cachefiles_update_object(struct fscache_object *_object)
212 object = container_of(_object, struct cachefiles_object, fscache); 210 object = container_of(_object, struct cachefiles_object, fscache);
213 cache = container_of(object->fscache.cache, struct cachefiles_cache, 211 cache = container_of(object->fscache.cache, struct cachefiles_cache,
214 cache); 212 cache);
213
214 if (!fscache_use_cookie(_object)) {
215 _leave(" [relinq]");
216 return;
217 }
218
215 cookie = object->fscache.cookie; 219 cookie = object->fscache.cookie;
216 220
217 if (!cookie->def->get_aux) { 221 if (!cookie->def->get_aux) {
222 fscache_unuse_cookie(_object);
218 _leave(" [no aux]"); 223 _leave(" [no aux]");
219 return; 224 return;
220 } 225 }
221 226
222 auxdata = kmalloc(2 + 512 + 3, cachefiles_gfp); 227 auxdata = kmalloc(2 + 512 + 3, cachefiles_gfp);
223 if (!auxdata) { 228 if (!auxdata) {
229 fscache_unuse_cookie(_object);
224 _leave(" [nomem]"); 230 _leave(" [nomem]");
225 return; 231 return;
226 } 232 }
227 233
228 auxlen = cookie->def->get_aux(cookie->netfs_data, auxdata->data, 511); 234 auxlen = cookie->def->get_aux(cookie->netfs_data, auxdata->data, 511);
235 fscache_unuse_cookie(_object);
229 ASSERTCMP(auxlen, <, 511); 236 ASSERTCMP(auxlen, <, 511);
230 237
231 auxdata->len = auxlen + 1; 238 auxdata->len = auxlen + 1;
@@ -263,7 +270,7 @@ static void cachefiles_drop_object(struct fscache_object *_object)
263#endif 270#endif
264 271
265 /* delete retired objects */ 272 /* delete retired objects */
266 if (object->fscache.state == FSCACHE_OBJECT_RECYCLING && 273 if (test_bit(FSCACHE_COOKIE_RETIRED, &object->fscache.cookie->flags) &&
267 _object != cache->cache.fsdef 274 _object != cache->cache.fsdef
268 ) { 275 ) {
269 _debug("- retire object OBJ%x", object->fscache.debug_id); 276 _debug("- retire object OBJ%x", object->fscache.debug_id);
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 8c01c5fcdf75..25badd1aec5c 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -38,7 +38,7 @@ void __cachefiles_printk_object(struct cachefiles_object *object,
38 printk(KERN_ERR "%sobject: OBJ%x\n", 38 printk(KERN_ERR "%sobject: OBJ%x\n",
39 prefix, object->fscache.debug_id); 39 prefix, object->fscache.debug_id);
40 printk(KERN_ERR "%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n", 40 printk(KERN_ERR "%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n",
41 prefix, fscache_object_states[object->fscache.state], 41 prefix, object->fscache.state->name,
42 object->fscache.flags, work_busy(&object->fscache.work), 42 object->fscache.flags, work_busy(&object->fscache.work),
43 object->fscache.events, object->fscache.event_mask); 43 object->fscache.events, object->fscache.event_mask);
44 printk(KERN_ERR "%sops=%u inp=%u exc=%u\n", 44 printk(KERN_ERR "%sops=%u inp=%u exc=%u\n",
@@ -127,10 +127,10 @@ static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
127found_dentry: 127found_dentry:
128 kdebug("preemptive burial: OBJ%x [%s] %p", 128 kdebug("preemptive burial: OBJ%x [%s] %p",
129 object->fscache.debug_id, 129 object->fscache.debug_id,
130 fscache_object_states[object->fscache.state], 130 object->fscache.state->name,
131 dentry); 131 dentry);
132 132
133 if (object->fscache.state < FSCACHE_OBJECT_DYING) { 133 if (fscache_object_is_live(&object->fscache)) {
134 printk(KERN_ERR "\n"); 134 printk(KERN_ERR "\n");
135 printk(KERN_ERR "CacheFiles: Error:" 135 printk(KERN_ERR "CacheFiles: Error:"
136 " Can't preemptively bury live object\n"); 136 " Can't preemptively bury live object\n");
@@ -192,7 +192,7 @@ try_again:
192 /* an old object from a previous incarnation is hogging the slot - we 192 /* an old object from a previous incarnation is hogging the slot - we
193 * need to wait for it to be destroyed */ 193 * need to wait for it to be destroyed */
194wait_for_old_object: 194wait_for_old_object:
195 if (xobject->fscache.state < FSCACHE_OBJECT_DYING) { 195 if (fscache_object_is_live(&object->fscache)) {
196 printk(KERN_ERR "\n"); 196 printk(KERN_ERR "\n");
197 printk(KERN_ERR "CacheFiles: Error:" 197 printk(KERN_ERR "CacheFiles: Error:"
198 " Unexpected object collision\n"); 198 " Unexpected object collision\n");
@@ -836,7 +836,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
836 // dir->d_name.len, dir->d_name.len, dir->d_name.name, filename); 836 // dir->d_name.len, dir->d_name.len, dir->d_name.name, filename);
837 837
838 /* look up the victim */ 838 /* look up the victim */
839 mutex_lock_nested(&dir->d_inode->i_mutex, 1); 839 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
840 840
841 start = jiffies; 841 start = jiffies;
842 victim = lookup_one_len(filename, dir, strlen(filename)); 842 victim = lookup_one_len(filename, dir, strlen(filename));
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index 73b46288b54b..2476e5162609 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -109,13 +109,12 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object,
109 struct dentry *dentry = object->dentry; 109 struct dentry *dentry = object->dentry;
110 int ret; 110 int ret;
111 111
112 ASSERT(object->fscache.cookie);
113 ASSERT(dentry); 112 ASSERT(dentry);
114 113
115 _enter("%p,#%d", object, auxdata->len); 114 _enter("%p,#%d", object, auxdata->len);
116 115
117 /* attempt to install the cache metadata directly */ 116 /* attempt to install the cache metadata directly */
118 _debug("SET %s #%u", object->fscache.cookie->def->name, auxdata->len); 117 _debug("SET #%u", auxdata->len);
119 118
120 ret = vfs_setxattr(dentry, cachefiles_xattr_cache, 119 ret = vfs_setxattr(dentry, cachefiles_xattr_cache,
121 &auxdata->type, auxdata->len, 120 &auxdata->type, auxdata->len,
@@ -138,13 +137,12 @@ int cachefiles_update_object_xattr(struct cachefiles_object *object,
138 struct dentry *dentry = object->dentry; 137 struct dentry *dentry = object->dentry;
139 int ret; 138 int ret;
140 139
141 ASSERT(object->fscache.cookie);
142 ASSERT(dentry); 140 ASSERT(dentry);
143 141
144 _enter("%p,#%d", object, auxdata->len); 142 _enter("%p,#%d", object, auxdata->len);
145 143
146 /* attempt to install the cache metadata directly */ 144 /* attempt to install the cache metadata directly */
147 _debug("SET %s #%u", object->fscache.cookie->def->name, auxdata->len); 145 _debug("SET #%u", auxdata->len);
148 146
149 ret = vfs_setxattr(dentry, cachefiles_xattr_cache, 147 ret = vfs_setxattr(dentry, cachefiles_xattr_cache,
150 &auxdata->type, auxdata->len, 148 &auxdata->type, auxdata->len,