1 /* CacheFiles path walking and related routines
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
12 #include <linux/module.h>
13 #include <linux/sched.h>
14 #include <linux/file.h>
16 #include <linux/fsnotify.h>
17 #include <linux/quotaops.h>
18 #include <linux/xattr.h>
19 #include <linux/mount.h>
20 #include <linux/namei.h>
21 #include <linux/security.h>
22 #include <linux/slab.h>
25 #define CACHEFILES_KEYBUF_SIZE 512
28 * dump debugging info about an object
31 void __cachefiles_printk_object(struct cachefiles_object *object,
34 struct fscache_cookie *cookie;
38 pr_err("%sobject: OBJ%x\n", prefix, object->fscache.debug_id);
39 pr_err("%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n",
40 prefix, object->fscache.state->name,
41 object->fscache.flags, work_busy(&object->fscache.work),
42 object->fscache.events, object->fscache.event_mask);
43 pr_err("%sops=%u inp=%u exc=%u\n",
44 prefix, object->fscache.n_ops, object->fscache.n_in_progress,
45 object->fscache.n_exclusive);
46 pr_err("%sparent=%p\n",
47 prefix, object->fscache.parent);
49 spin_lock(&object->fscache.lock);
50 cookie = object->fscache.cookie;
52 pr_err("%scookie=%p [pr=%p nd=%p fl=%lx]\n",
54 object->fscache.cookie,
55 object->fscache.cookie->parent,
56 object->fscache.cookie->netfs_data,
57 object->fscache.cookie->flags);
58 pr_err("%skey=[%u] '", prefix, cookie->key_len);
59 k = (cookie->key_len <= sizeof(cookie->inline_key)) ?
60 cookie->inline_key : cookie->key;
61 for (loop = 0; loop < cookie->key_len; loop++)
62 pr_cont("%02x", k[loop]);
65 pr_err("%scookie=NULL\n", prefix);
67 spin_unlock(&object->fscache.lock);
71 * dump debugging info about a pair of objects
73 static noinline void cachefiles_printk_object(struct cachefiles_object *object,
74 struct cachefiles_object *xobject)
77 __cachefiles_printk_object(object, "");
79 __cachefiles_printk_object(xobject, "x");
83 * mark the owner of a dentry, if there is one, to indicate that that dentry
84 * has been preemptively deleted
85 * - the caller must hold the i_mutex on the dentry's parent as required to
86 * call vfs_unlink(), vfs_rmdir() or vfs_rename()
88 static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
89 struct dentry *dentry,
90 enum fscache_why_object_killed why)
92 struct cachefiles_object *object;
95 _enter(",'%pd'", dentry);
97 write_lock(&cache->active_lock);
99 p = cache->active_nodes.rb_node;
101 object = rb_entry(p, struct cachefiles_object, active_node);
102 if (object->dentry > dentry)
104 else if (object->dentry < dentry)
110 write_unlock(&cache->active_lock);
111 trace_cachefiles_mark_buried(NULL, dentry, why);
112 _leave(" [no owner]");
115 /* found the dentry for */
117 kdebug("preemptive burial: OBJ%x [%s] %p",
118 object->fscache.debug_id,
119 object->fscache.state->name,
122 trace_cachefiles_mark_buried(object, dentry, why);
124 if (fscache_object_is_live(&object->fscache)) {
126 pr_err("Error: Can't preemptively bury live object\n");
127 cachefiles_printk_object(object, NULL);
129 if (why != FSCACHE_OBJECT_IS_STALE)
130 fscache_object_mark_killed(&object->fscache, why);
133 write_unlock(&cache->active_lock);
134 _leave(" [owner marked]");
138 * record the fact that an object is now active
140 static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
141 struct cachefiles_object *object)
143 struct cachefiles_object *xobject;
144 struct rb_node **_p, *_parent = NULL;
145 struct dentry *dentry;
147 _enter(",%p", object);
150 write_lock(&cache->active_lock);
152 dentry = object->dentry;
153 trace_cachefiles_mark_active(object, dentry);
155 if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) {
156 pr_err("Error: Object already active\n");
157 cachefiles_printk_object(object, NULL);
161 _p = &cache->active_nodes.rb_node;
164 xobject = rb_entry(_parent,
165 struct cachefiles_object, active_node);
167 ASSERT(xobject != object);
169 if (xobject->dentry > dentry)
170 _p = &(*_p)->rb_left;
171 else if (xobject->dentry < dentry)
172 _p = &(*_p)->rb_right;
174 goto wait_for_old_object;
177 rb_link_node(&object->active_node, _parent, _p);
178 rb_insert_color(&object->active_node, &cache->active_nodes);
180 write_unlock(&cache->active_lock);
184 /* an old object from a previous incarnation is hogging the slot - we
185 * need to wait for it to be destroyed */
187 trace_cachefiles_wait_active(object, dentry, xobject);
188 clear_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags);
190 if (fscache_object_is_live(&xobject->fscache)) {
192 pr_err("Error: Unexpected object collision\n");
193 cachefiles_printk_object(object, xobject);
195 atomic_inc(&xobject->usage);
196 write_unlock(&cache->active_lock);
198 if (test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags)) {
199 wait_queue_head_t *wq;
201 signed long timeout = 60 * HZ;
202 wait_queue_entry_t wait;
205 /* if the object we're waiting for is queued for processing,
206 * then just put ourselves on the queue behind it */
207 if (work_pending(&xobject->fscache.work)) {
208 _debug("queue OBJ%x behind OBJ%x immediately",
209 object->fscache.debug_id,
210 xobject->fscache.debug_id);
214 /* otherwise we sleep until either the object we're waiting for
215 * is done, or the fscache_object is congested */
216 wq = bit_waitqueue(&xobject->flags, CACHEFILES_OBJECT_ACTIVE);
220 prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE);
221 if (!test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags))
224 requeue = fscache_object_sleep_till_congested(&timeout);
225 } while (timeout > 0 && !requeue);
226 finish_wait(wq, &wait);
229 test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags)) {
230 _debug("queue OBJ%x behind OBJ%x after wait",
231 object->fscache.debug_id,
232 xobject->fscache.debug_id);
238 pr_err("Error: Overlong wait for old active object to go away\n");
239 cachefiles_printk_object(object, xobject);
244 ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags));
246 cache->cache.ops->put_object(&xobject->fscache,
247 (enum fscache_obj_ref_trace)cachefiles_obj_put_wait_retry);
251 cache->cache.ops->put_object(&xobject->fscache,
252 (enum fscache_obj_ref_trace)cachefiles_obj_put_wait_timeo);
253 _leave(" = -ETIMEDOUT");
258 * Mark an object as being inactive.
260 void cachefiles_mark_object_inactive(struct cachefiles_cache *cache,
261 struct cachefiles_object *object,
264 struct dentry *dentry = object->dentry;
265 struct inode *inode = d_backing_inode(dentry);
267 trace_cachefiles_mark_inactive(object, dentry, inode);
269 write_lock(&cache->active_lock);
270 rb_erase(&object->active_node, &cache->active_nodes);
271 clear_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags);
272 write_unlock(&cache->active_lock);
274 wake_up_bit(&object->flags, CACHEFILES_OBJECT_ACTIVE);
276 /* This object can now be culled, so we need to let the daemon know
277 * that there is something it can remove if it needs to.
279 atomic_long_add(i_blocks, &cache->b_released);
280 if (atomic_inc_return(&cache->f_released))
281 cachefiles_state_changed(cache);
285 * delete an object representation from the cache
286 * - file backed objects are unlinked
287 * - directory backed objects are stuffed into the graveyard for userspace to
289 * - unlocks the directory mutex
291 static int cachefiles_bury_object(struct cachefiles_cache *cache,
292 struct cachefiles_object *object,
296 enum fscache_why_object_killed why)
298 struct dentry *grave, *trap;
299 struct path path, path_to_graveyard;
300 char nbuffer[8 + 8 + 1];
303 _enter(",'%pd','%pd'", dir, rep);
305 _debug("remove %p from %p", rep, dir);
307 /* non-directories can just be unlinked */
308 if (!d_is_dir(rep)) {
309 _debug("unlink stale object");
311 path.mnt = cache->mnt;
313 ret = security_path_unlink(&path, rep);
315 cachefiles_io_error(cache, "Unlink security error");
317 trace_cachefiles_unlink(object, rep, why);
318 ret = vfs_unlink(d_inode(dir), rep, NULL);
321 cachefiles_mark_object_buried(cache, rep, why);
324 inode_unlock(d_inode(dir));
327 cachefiles_io_error(cache, "Unlink failed");
329 _leave(" = %d", ret);
333 /* directories have to be moved to the graveyard */
334 _debug("move stale object to graveyard");
335 inode_unlock(d_inode(dir));
338 /* first step is to make up a grave dentry in the graveyard */
339 sprintf(nbuffer, "%08x%08x",
340 (uint32_t) ktime_get_real_seconds(),
341 (uint32_t) atomic_inc_return(&cache->gravecounter));
343 /* do the multiway lock magic */
344 trap = lock_rename(cache->graveyard, dir);
346 /* do some checks before getting the grave dentry */
347 if (rep->d_parent != dir || IS_DEADDIR(d_inode(rep))) {
348 /* the entry was probably culled when we dropped the parent dir
350 unlock_rename(cache->graveyard, dir);
351 _leave(" = 0 [culled?]");
355 if (!d_can_lookup(cache->graveyard)) {
356 unlock_rename(cache->graveyard, dir);
357 cachefiles_io_error(cache, "Graveyard no longer a directory");
362 unlock_rename(cache->graveyard, dir);
363 cachefiles_io_error(cache, "May not make directory loop");
367 if (d_mountpoint(rep)) {
368 unlock_rename(cache->graveyard, dir);
369 cachefiles_io_error(cache, "Mountpoint in cache");
373 grave = lookup_one_len(nbuffer, cache->graveyard, strlen(nbuffer));
375 unlock_rename(cache->graveyard, dir);
377 if (PTR_ERR(grave) == -ENOMEM) {
378 _leave(" = -ENOMEM");
382 cachefiles_io_error(cache, "Lookup error %ld",
387 if (d_is_positive(grave)) {
388 unlock_rename(cache->graveyard, dir);
395 if (d_mountpoint(grave)) {
396 unlock_rename(cache->graveyard, dir);
398 cachefiles_io_error(cache, "Mountpoint in graveyard");
402 /* target should not be an ancestor of source */
404 unlock_rename(cache->graveyard, dir);
406 cachefiles_io_error(cache, "May not make directory loop");
410 /* attempt the rename */
411 path.mnt = cache->mnt;
413 path_to_graveyard.mnt = cache->mnt;
414 path_to_graveyard.dentry = cache->graveyard;
415 ret = security_path_rename(&path, rep, &path_to_graveyard, grave, 0);
417 cachefiles_io_error(cache, "Rename security error %d", ret);
419 trace_cachefiles_rename(object, rep, grave, why);
420 ret = vfs_rename(d_inode(dir), rep,
421 d_inode(cache->graveyard), grave, NULL, 0);
422 if (ret != 0 && ret != -ENOMEM)
423 cachefiles_io_error(cache,
424 "Rename failed with error %d", ret);
427 cachefiles_mark_object_buried(cache, rep, why);
430 unlock_rename(cache->graveyard, dir);
437 * delete an object representation from the cache
439 int cachefiles_delete_object(struct cachefiles_cache *cache,
440 struct cachefiles_object *object)
445 _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry);
447 ASSERT(object->dentry);
448 ASSERT(d_backing_inode(object->dentry));
449 ASSERT(object->dentry->d_parent);
451 dir = dget_parent(object->dentry);
453 inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
455 if (test_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->fscache.flags)) {
456 /* object allocation for the same key preemptively deleted this
457 * object's file so that it could create its own file */
458 _debug("object preemptively buried");
459 inode_unlock(d_inode(dir));
462 /* we need to check that our parent is _still_ our parent - it
463 * may have been renamed */
464 if (dir == object->dentry->d_parent) {
465 ret = cachefiles_bury_object(cache, object, dir,
466 object->dentry, false,
467 FSCACHE_OBJECT_WAS_RETIRED);
469 /* it got moved, presumably by cachefilesd culling it,
470 * so it's no longer in the key path and we can ignore
472 inode_unlock(d_inode(dir));
478 _leave(" = %d", ret);
483 * walk from the parent object to the child object through the backing
484 * filesystem, creating directories as we go
486 int cachefiles_walk_to_object(struct cachefiles_object *parent,
487 struct cachefiles_object *object,
489 struct cachefiles_xattr *auxdata)
491 struct cachefiles_cache *cache;
492 struct dentry *dir, *next = NULL;
499 _enter("OBJ%x{%p},OBJ%x,%s,",
500 parent->fscache.debug_id, parent->dentry,
501 object->fscache.debug_id, key);
503 cache = container_of(parent->fscache.cache,
504 struct cachefiles_cache, cache);
505 path.mnt = cache->mnt;
507 ASSERT(parent->dentry);
508 ASSERT(d_backing_inode(parent->dentry));
510 if (!(d_is_dir(parent->dentry))) {
511 // TODO: convert file to dir
512 _leave("looking up in none directory");
516 dir = dget(parent->dentry);
519 /* attempt to transit the first directory component */
523 /* key ends in a double NUL */
524 key = key + nlen + 1;
529 /* search the current directory for the element name */
530 _debug("lookup '%s'", name);
532 inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
535 next = lookup_one_len(name, dir, nlen);
536 cachefiles_hist(cachefiles_lookup_histogram, start);
538 trace_cachefiles_lookup(object, next, NULL);
542 inode = d_backing_inode(next);
543 trace_cachefiles_lookup(object, next, inode);
544 _debug("next -> %p %s", next, inode ? "positive" : "negative");
547 object->new = !inode;
549 /* if this element of the path doesn't exist, then the lookup phase
550 * failed, and we can release any readers in the certain knowledge that
551 * there's nothing for them to actually read */
552 if (d_is_negative(next))
553 fscache_object_lookup_negative(&object->fscache);
555 /* we need to create the object if it's negative */
556 if (key || object->type == FSCACHE_COOKIE_TYPE_INDEX) {
557 /* index objects and intervening tree levels must be subdirs */
558 if (d_is_negative(next)) {
559 ret = cachefiles_has_space(cache, 1, 0);
564 ret = security_path_mkdir(&path, next, 0);
568 ret = vfs_mkdir(d_inode(dir), next, 0);
569 cachefiles_hist(cachefiles_mkdir_histogram, start);
571 trace_cachefiles_mkdir(object, next, ret);
575 if (unlikely(d_unhashed(next))) {
577 inode_unlock(d_inode(dir));
580 ASSERT(d_backing_inode(next));
582 _debug("mkdir -> %p{%p{ino=%lu}}",
583 next, d_backing_inode(next), d_backing_inode(next)->i_ino);
585 } else if (!d_can_lookup(next)) {
586 pr_err("inode %lu is not a directory\n",
587 d_backing_inode(next)->i_ino);
593 /* non-index objects start out life as files */
594 if (d_is_negative(next)) {
595 ret = cachefiles_has_space(cache, 1, 0);
600 ret = security_path_mknod(&path, next, S_IFREG, 0);
604 ret = vfs_create(d_inode(dir), next, S_IFREG, true);
605 cachefiles_hist(cachefiles_create_histogram, start);
606 trace_cachefiles_create(object, next, ret);
610 ASSERT(d_backing_inode(next));
612 _debug("create -> %p{%p{ino=%lu}}",
613 next, d_backing_inode(next), d_backing_inode(next)->i_ino);
615 } else if (!d_can_lookup(next) &&
618 pr_err("inode %lu is not a file or directory\n",
619 d_backing_inode(next)->i_ino);
625 /* process the next component */
628 inode_unlock(d_inode(dir));
635 /* we've found the object we were looking for */
636 object->dentry = next;
638 /* if we've found that the terminal object exists, then we need to
639 * check its attributes and delete it if it's out of date */
641 _debug("validate '%pd'", next);
643 ret = cachefiles_check_object_xattr(object, auxdata);
644 if (ret == -ESTALE) {
645 /* delete the object (the deleter drops the directory
647 object->dentry = NULL;
649 ret = cachefiles_bury_object(cache, object, dir, next,
651 FSCACHE_OBJECT_IS_STALE);
658 _debug("redo lookup");
659 fscache_object_retrying_stale(&object->fscache);
664 /* note that we're now using this object */
665 ret = cachefiles_mark_object_active(cache, object);
667 inode_unlock(d_inode(dir));
671 if (ret == -ETIMEDOUT)
672 goto mark_active_timed_out;
674 _debug("=== OBTAINED_OBJECT ===");
677 /* attach data to a newly constructed terminal object */
678 ret = cachefiles_set_object_xattr(object, auxdata);
682 /* always update the atime on an object we've just looked up
683 * (this is used to keep track of culling, and atimes are only
684 * updated by read, write and readdir but not lookup or
690 /* open a file interface onto a data file */
691 if (object->type != FSCACHE_COOKIE_TYPE_INDEX) {
692 if (d_is_reg(object->dentry)) {
693 const struct address_space_operations *aops;
696 aops = d_backing_inode(object->dentry)->i_mapping->a_ops;
699 if (object->dentry->d_sb->s_blocksize > PAGE_SIZE)
702 object->backer = object->dentry;
704 BUG(); // TODO: open file in data-class subdir
709 fscache_obtained_object(&object->fscache);
711 _leave(" = 0 [%lu]", d_backing_inode(object->dentry)->i_ino);
715 fscache_object_mark_killed(&object->fscache, FSCACHE_OBJECT_NO_SPACE);
717 _debug("create error %d", ret);
719 cachefiles_io_error(cache, "Create/mkdir failed");
722 mark_active_timed_out:
723 _debug("mark active timed out");
727 _debug("check error %d", ret);
728 cachefiles_mark_object_inactive(
729 cache, object, d_backing_inode(object->dentry)->i_blocks);
731 dput(object->dentry);
732 object->dentry = NULL;
736 _debug("delete error %d", ret);
740 _debug("lookup error %ld", PTR_ERR(next));
743 cachefiles_io_error(cache, "Lookup failed");
746 inode_unlock(d_inode(dir));
751 _leave(" = error %d", -ret);
758 struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
762 struct dentry *subdir;
767 _enter(",,%s", dirname);
769 /* search the current directory for the element name */
770 inode_lock(d_inode(dir));
774 subdir = lookup_one_len(dirname, dir, strlen(dirname));
775 cachefiles_hist(cachefiles_lookup_histogram, start);
776 if (IS_ERR(subdir)) {
777 if (PTR_ERR(subdir) == -ENOMEM)
782 _debug("subdir -> %p %s",
783 subdir, d_backing_inode(subdir) ? "positive" : "negative");
785 /* we need to create the subdir if it doesn't exist yet */
786 if (d_is_negative(subdir)) {
787 ret = cachefiles_has_space(cache, 1, 0);
791 _debug("attempt mkdir");
793 path.mnt = cache->mnt;
795 ret = security_path_mkdir(&path, subdir, 0700);
798 ret = vfs_mkdir(d_inode(dir), subdir, 0700);
802 if (unlikely(d_unhashed(subdir))) {
806 ASSERT(d_backing_inode(subdir));
808 _debug("mkdir -> %p{%p{ino=%lu}}",
810 d_backing_inode(subdir),
811 d_backing_inode(subdir)->i_ino);
814 inode_unlock(d_inode(dir));
816 /* we need to make sure the subdir is a directory */
817 ASSERT(d_backing_inode(subdir));
819 if (!d_can_lookup(subdir)) {
820 pr_err("%s is not a directory\n", dirname);
826 if (!(d_backing_inode(subdir)->i_opflags & IOP_XATTR) ||
827 !d_backing_inode(subdir)->i_op->lookup ||
828 !d_backing_inode(subdir)->i_op->mkdir ||
829 !d_backing_inode(subdir)->i_op->create ||
830 !d_backing_inode(subdir)->i_op->rename ||
831 !d_backing_inode(subdir)->i_op->rmdir ||
832 !d_backing_inode(subdir)->i_op->unlink)
835 _leave(" = [%lu]", d_backing_inode(subdir)->i_ino);
840 _leave(" = %d [check]", ret);
844 inode_unlock(d_inode(dir));
846 pr_err("mkdir %s failed with error %d\n", dirname, ret);
850 inode_unlock(d_inode(dir));
851 ret = PTR_ERR(subdir);
852 pr_err("Lookup %s failed with error %d\n", dirname, ret);
856 inode_unlock(d_inode(dir));
857 _leave(" = -ENOMEM");
858 return ERR_PTR(-ENOMEM);
862 * find out if an object is in use or not
863 * - if finds object and it's not in use:
864 * - returns a pointer to the object and a reference on it
865 * - returns with the directory locked
867 static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
871 struct cachefiles_object *object;
873 struct dentry *victim;
880 /* look up the victim */
881 inode_lock_nested(d_inode(dir), I_MUTEX_PARENT);
884 victim = lookup_one_len(filename, dir, strlen(filename));
885 cachefiles_hist(cachefiles_lookup_histogram, start);
889 //_debug("victim -> %p %s",
890 // victim, d_backing_inode(victim) ? "positive" : "negative");
892 /* if the object is no longer there then we probably retired the object
893 * at the netfs's request whilst the cull was in progress
895 if (d_is_negative(victim)) {
896 inode_unlock(d_inode(dir));
898 _leave(" = -ENOENT [absent]");
899 return ERR_PTR(-ENOENT);
902 /* check to see if we're using this object */
903 read_lock(&cache->active_lock);
905 _n = cache->active_nodes.rb_node;
908 object = rb_entry(_n, struct cachefiles_object, active_node);
910 if (object->dentry > victim)
912 else if (object->dentry < victim)
918 read_unlock(&cache->active_lock);
920 //_leave(" = %p", victim);
924 read_unlock(&cache->active_lock);
925 inode_unlock(d_inode(dir));
927 //_leave(" = -EBUSY [in use]");
928 return ERR_PTR(-EBUSY);
931 inode_unlock(d_inode(dir));
932 ret = PTR_ERR(victim);
933 if (ret == -ENOENT) {
934 /* file or dir now absent - probably retired by netfs */
935 _leave(" = -ESTALE [absent]");
936 return ERR_PTR(-ESTALE);
940 cachefiles_io_error(cache, "Lookup failed");
941 } else if (ret != -ENOMEM) {
942 pr_err("Internal error: %d\n", ret);
946 _leave(" = %d", ret);
951 * cull an object if it's not in use
952 * - called only by cache manager daemon
954 int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
957 struct dentry *victim;
960 _enter(",%pd/,%s", dir, filename);
962 victim = cachefiles_check_active(cache, dir, filename);
964 return PTR_ERR(victim);
966 _debug("victim -> %p %s",
967 victim, d_backing_inode(victim) ? "positive" : "negative");
969 /* okay... the victim is not being used so we can cull it
970 * - start by marking it as stale
972 _debug("victim is cullable");
974 ret = cachefiles_remove_object_xattr(cache, victim);
978 /* actually remove the victim (drops the dir mutex) */
981 ret = cachefiles_bury_object(cache, NULL, dir, victim, false,
982 FSCACHE_OBJECT_WAS_CULLED);
991 inode_unlock(d_inode(dir));
994 if (ret == -ENOENT) {
995 /* file or dir now absent - probably retired by netfs */
996 _leave(" = -ESTALE [absent]");
1000 if (ret != -ENOMEM) {
1001 pr_err("Internal error: %d\n", ret);
1005 _leave(" = %d", ret);
1010 * find out if an object is in use or not
1011 * - called only by cache manager daemon
1012 * - returns -EBUSY or 0 to indicate whether an object is in use or not
1014 int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir,
1017 struct dentry *victim;
1019 //_enter(",%pd/,%s",
1022 victim = cachefiles_check_active(cache, dir, filename);
1024 return PTR_ERR(victim);
1026 inode_unlock(d_inode(dir));