aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 02:40:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 02:40:15 -0400
commit1b5a5f59e3435337bede67b9255bbb1d39fc4827 (patch)
treec604f571dcc7bb26dfe5498eb920873248639c62 /fs
parentb11445f830df0ec9271f39bff19ecc6f8db58eb8 (diff)
parentd5d962265d99088ce96480db3e61358d7170e24c (diff)
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
Diffstat (limited to 'fs')
-rw-r--r--fs/cachefiles/interface.c33
-rw-r--r--fs/cachefiles/namei.c2
-rw-r--r--fs/fscache/object-list.c16
3 files changed, 23 insertions, 28 deletions
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index 584743d456c3..1c7293c3a93a 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -268,20 +268,27 @@ static void cachefiles_drop_object(struct fscache_object *_object)
268 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); 268 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000);
269#endif 269#endif
270 270
271 /* delete retired objects */ 271 /* We need to tidy the object up if we did in fact manage to open it.
272 if (test_bit(FSCACHE_OBJECT_RETIRED, &object->fscache.flags) && 272 * It's possible for us to get here before the object is fully
273 _object != cache->cache.fsdef 273 * initialised if the parent goes away or the object gets retired
274 ) { 274 * before we set it up.
275 _debug("- retire object OBJ%x", object->fscache.debug_id); 275 */
276 cachefiles_begin_secure(cache, &saved_cred); 276 if (object->dentry) {
277 cachefiles_delete_object(cache, object); 277 /* delete retired objects */
278 cachefiles_end_secure(cache, saved_cred); 278 if (test_bit(FSCACHE_OBJECT_RETIRED, &object->fscache.flags) &&
279 } 279 _object != cache->cache.fsdef
280 ) {
281 _debug("- retire object OBJ%x", object->fscache.debug_id);
282 cachefiles_begin_secure(cache, &saved_cred);
283 cachefiles_delete_object(cache, object);
284 cachefiles_end_secure(cache, saved_cred);
285 }
280 286
281 /* close the filesystem stuff attached to the object */ 287 /* close the filesystem stuff attached to the object */
282 if (object->backer != object->dentry) 288 if (object->backer != object->dentry)
283 dput(object->backer); 289 dput(object->backer);
284 object->backer = NULL; 290 object->backer = NULL;
291 }
285 292
286 /* note that the object is now inactive */ 293 /* note that the object is now inactive */
287 if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) { 294 if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) {
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index dad7d9542a24..e12f189d539b 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -189,7 +189,7 @@ try_again:
189 /* an old object from a previous incarnation is hogging the slot - we 189 /* an old object from a previous incarnation is hogging the slot - we
190 * need to wait for it to be destroyed */ 190 * need to wait for it to be destroyed */
191wait_for_old_object: 191wait_for_old_object:
192 if (fscache_object_is_live(&object->fscache)) { 192 if (fscache_object_is_live(&xobject->fscache)) {
193 pr_err("\n"); 193 pr_err("\n");
194 pr_err("Error: Unexpected object collision\n"); 194 pr_err("Error: Unexpected object collision\n");
195 cachefiles_printk_object(object, xobject); 195 cachefiles_printk_object(object, xobject);
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index b8179ca6bf9d..51dde817e1f2 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -380,26 +380,14 @@ no_config:
380static int fscache_objlist_open(struct inode *inode, struct file *file) 380static int fscache_objlist_open(struct inode *inode, struct file *file)
381{ 381{
382 struct fscache_objlist_data *data; 382 struct fscache_objlist_data *data;
383 struct seq_file *m;
384 int ret;
385 383
386 ret = seq_open(file, &fscache_objlist_ops); 384 data = __seq_open_private(file, &fscache_objlist_ops, sizeof(*data));
387 if (ret < 0) 385 if (!data)
388 return ret;
389
390 m = file->private_data;
391
392 /* buffer for key extraction */
393 data = kmalloc(sizeof(struct fscache_objlist_data), GFP_KERNEL);
394 if (!data) {
395 seq_release(inode, file);
396 return -ENOMEM; 386 return -ENOMEM;
397 }
398 387
399 /* get the configuration key */ 388 /* get the configuration key */
400 fscache_objlist_config(data); 389 fscache_objlist_config(data);
401 390
402 m->private = data;
403 return 0; 391 return 0;
404} 392}
405 393