aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/vnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/afs/vnode.c')
-rw-r--r--fs/afs/vnode.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c
index bea8bd9e7b2a..c36c98ce2c3c 100644
--- a/fs/afs/vnode.c
+++ b/fs/afs/vnode.c
@@ -869,3 +869,55 @@ no_server:
869 spin_unlock(&vnode->lock); 869 spin_unlock(&vnode->lock);
870 return PTR_ERR(server); 870 return PTR_ERR(server);
871} 871}
872
873/*
874 * get the status of a volume
875 */
876int afs_vnode_get_volume_status(struct afs_vnode *vnode, struct key *key,
877 struct afs_volume_status *vs)
878{
879 struct afs_server *server;
880 int ret;
881
882 _enter("%s{%x:%u.%u},%x,",
883 vnode->volume->vlocation->vldb.name,
884 vnode->fid.vid,
885 vnode->fid.vnode,
886 vnode->fid.unique,
887 key_serial(key));
888
889 /* this op will fetch the status */
890 spin_lock(&vnode->lock);
891 vnode->update_cnt++;
892 spin_unlock(&vnode->lock);
893
894 do {
895 /* pick a server to query */
896 server = afs_volume_pick_fileserver(vnode);
897 if (IS_ERR(server))
898 goto no_server;
899
900 _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
901
902 ret = afs_fs_get_volume_status(server, key, vnode, vs, &afs_sync_call);
903
904 } while (!afs_volume_release_fileserver(vnode, server, ret));
905
906 /* adjust the flags */
907 if (ret == 0) {
908 afs_vnode_finalise_status_update(vnode, server);
909 afs_put_server(server);
910 } else {
911 afs_vnode_status_update_failed(vnode, ret);
912 }
913
914 _leave(" = %d", ret);
915 return ret;
916
917no_server:
918 spin_lock(&vnode->lock);
919 vnode->update_cnt--;
920 ASSERTCMP(vnode->update_cnt, >=, 0);
921 spin_unlock(&vnode->lock);
922 return PTR_ERR(server);
923}