12 #include <linux/kernel.h>
13 #include <linux/module.h>
16 #include <linux/sched.h>
30 bad = dump_tree_aux(node->
rb_left, node, depth + 2,
'/');
33 _debug(
"%c %*.*s%c%p {%d}",
43 bad |= dump_tree_aux(node->
rb_right, node, depth + 2,
'\\');
59 static void afs_install_vnode(
struct afs_vnode *vnode,
66 _enter(
"%p,%p", vnode, server);
69 spin_lock(&old_server->
fs_lock);
71 spin_unlock(&old_server->
fs_lock);
86 if (vnode->
fid.vid < xvnode->
fid.vid)
88 else if (vnode->
fid.vid > xvnode->
fid.vid)
90 else if (vnode->
fid.vnode < xvnode->
fid.vnode)
92 else if (vnode->
fid.vnode > xvnode->
fid.vnode)
94 else if (vnode->
fid.unique < xvnode->
fid.unique)
96 else if (vnode->
fid.unique > xvnode->
fid.unique)
102 rb_link_node(&vnode->
server_rb, parent, p);
113 static void afs_vnode_note_promise(
struct afs_vnode *vnode,
120 _enter(
"%p,%p", vnode, server);
124 old_server = vnode->
server;
126 if (server == old_server &&
132 spin_lock(&old_server->
cb_lock);
138 spin_unlock(&old_server->
cb_lock);
141 if (vnode->
server != server)
142 afs_install_vnode(vnode, server);
145 _debug(
"PROMISE on %p {%lu}",
174 static void afs_vnode_deleted_remotely(
struct afs_vnode *vnode)
218 _enter(
"%p,%p", vnode, server);
220 spin_lock(&vnode->
lock);
222 afs_vnode_note_promise(vnode, server);
225 spin_unlock(&vnode->
lock);
235 static void afs_vnode_status_update_failed(
struct afs_vnode *vnode,
int ret)
237 _enter(
"{%x:%u},%d", vnode->
fid.vid, vnode->
fid.vnode, ret);
239 spin_lock(&vnode->
lock);
245 _debug(
"got NOENT from server - marking file deleted");
246 afs_vnode_deleted_remotely(vnode);
251 spin_unlock(&vnode->
lock);
268 unsigned long acl_order;
274 vnode->
volume->vlocation->vldb.name,
275 vnode->
fid.vid, vnode->
fid.vnode, vnode->
fid.unique);
292 spin_lock(&vnode->
lock);
296 spin_unlock(&vnode->
lock);
327 spin_unlock(&vnode->
lock);
332 spin_lock(&vnode->
lock);
336 spin_unlock(&vnode->
lock);
347 spin_unlock(&vnode->
lock);
357 _debug(
"USING SERVER: %p{%08x}",
373 _debug(
"failed [%d]", ret);
374 afs_vnode_status_update_failed(vnode, ret);
383 spin_lock(&vnode->
lock);
386 spin_unlock(&vnode->
lock);
388 return PTR_ERR(server);
401 _enter(
"%s{%x:%u.%u},%x,,,",
402 vnode->
volume->vlocation->vldb.name,
409 spin_lock(&vnode->
lock);
411 spin_unlock(&vnode->
lock);
433 afs_vnode_status_update_failed(vnode, ret);
440 spin_lock(&vnode->
lock);
443 spin_unlock(&vnode->
lock);
444 return PTR_ERR(server);
458 _enter(
"%s{%x:%u.%u},%x,%s,,",
459 vnode->
volume->vlocation->vldb.name,
467 spin_lock(&vnode->
lock);
469 spin_unlock(&vnode->
lock);
489 afs_vnode_status_update_failed(vnode, ret);
497 spin_lock(&vnode->
lock);
500 spin_unlock(&vnode->
lock);
502 return PTR_ERR(server);
514 _enter(
"%s{%x:%u.%u},%x,%s",
515 vnode->
volume->vlocation->vldb.name,
523 spin_lock(&vnode->
lock);
525 spin_unlock(&vnode->
lock);
545 afs_vnode_status_update_failed(vnode, ret);
552 spin_lock(&vnode->
lock);
555 spin_unlock(&vnode->
lock);
557 return PTR_ERR(server);
564 struct key *
key,
const char *name)
569 _enter(
"%s{%x:%u.%u},%s{%x:%u.%u},%x,%s",
570 dvnode->
volume->vlocation->vldb.name,
574 vnode->
volume->vlocation->vldb.name,
582 spin_lock(&vnode->
lock);
584 spin_unlock(&vnode->
lock);
585 spin_lock(&dvnode->
lock);
587 spin_unlock(&dvnode->
lock);
597 ret =
afs_fs_link(server, key, dvnode, vnode, name,
608 afs_vnode_status_update_failed(vnode, ret);
609 afs_vnode_status_update_failed(dvnode, ret);
616 spin_lock(&vnode->
lock);
619 spin_unlock(&vnode->
lock);
620 spin_lock(&dvnode->
lock);
623 spin_unlock(&dvnode->
lock);
625 return PTR_ERR(server);
632 const char *name,
const char *content,
640 _enter(
"%s{%x:%u.%u},%x,%s,%s,,,",
641 vnode->
volume->vlocation->vldb.name,
649 spin_lock(&vnode->
lock);
651 spin_unlock(&vnode->
lock);
671 afs_vnode_status_update_failed(vnode, ret);
679 spin_lock(&vnode->
lock);
682 spin_unlock(&vnode->
lock);
684 return PTR_ERR(server);
693 const char *orig_name,
694 const char *new_name)
699 _enter(
"%s{%x:%u.%u},%s{%u,%u,%u},%x,%s,%s",
700 orig_dvnode->
volume->vlocation->vldb.name,
701 orig_dvnode->
fid.vid,
702 orig_dvnode->
fid.vnode,
703 orig_dvnode->
fid.unique,
704 new_dvnode->
volume->vlocation->vldb.name,
706 new_dvnode->
fid.vnode,
707 new_dvnode->
fid.unique,
714 spin_lock(&orig_dvnode->
lock);
716 spin_unlock(&orig_dvnode->
lock);
717 if (new_dvnode != orig_dvnode) {
718 spin_lock(&new_dvnode->
lock);
720 spin_unlock(&new_dvnode->
lock);
739 if (new_dvnode != orig_dvnode)
743 afs_vnode_status_update_failed(orig_dvnode, ret);
744 if (new_dvnode != orig_dvnode)
745 afs_vnode_status_update_failed(new_dvnode, ret);
752 spin_lock(&orig_dvnode->
lock);
755 spin_unlock(&orig_dvnode->
lock);
756 if (new_dvnode != orig_dvnode) {
757 spin_lock(&new_dvnode->
lock);
760 spin_unlock(&new_dvnode->
lock);
763 return PTR_ERR(server);
770 unsigned offset,
unsigned to)
776 _enter(
"%s{%x:%u.%u},%x,%lx,%lx,%x,%x",
777 vnode->
volume->vlocation->vldb.name,
782 first, last, offset, to);
785 spin_lock(&vnode->
lock);
787 spin_unlock(&vnode->
lock);
807 afs_vnode_status_update_failed(vnode, ret);
814 spin_lock(&vnode->
lock);
817 spin_unlock(&vnode->
lock);
818 return PTR_ERR(server);
831 vnode->
volume->vlocation->vldb.name,
838 spin_lock(&vnode->
lock);
840 spin_unlock(&vnode->
lock);
859 afs_vnode_status_update_failed(vnode, ret);
866 spin_lock(&vnode->
lock);
869 spin_unlock(&vnode->
lock);
870 return PTR_ERR(server);
882 _enter(
"%s{%x:%u.%u},%x,",
883 vnode->
volume->vlocation->vldb.name,
909 return PTR_ERR(server);
921 _enter(
"%s{%x:%u.%u},%x,%u",
922 vnode->
volume->vlocation->vldb.name,
926 key_serial(key), type);
948 return PTR_ERR(server);
960 vnode->
volume->vlocation->vldb.name,
986 return PTR_ERR(server);
998 vnode->
volume->vlocation->vldb.name,
1024 return PTR_ERR(server);