This source file includes following definitions.
- nfs_rpc_call
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifdef MODULE
22 #include <linux/module.h>
23 #endif
24
25 #include <linux/sched.h>
26 #include <linux/nfs_fs.h>
27 #include <linux/errno.h>
28 #include <linux/socket.h>
29 #include <linux/fcntl.h>
30 #include <asm/segment.h>
31 #include <linux/in.h>
32 #include <linux/net.h>
33 #include <linux/mm.h>
34 #include <linux/rpcsock.h>
35
36
37
38
39 #define NFS_SLACK_SPACE 1024
40
41 #define _S(nr) (1<<((nr)-1))
42
43
44
45
46
47
48
49
50
51
52
53 int
54 nfs_rpc_call(struct nfs_server *server, int *start, int *end, int size)
55 {
56 struct rpc_timeout timeout;
57 unsigned long maxtimeo;
58 unsigned long oldmask;
59 int major_timeout_seen, result;
60
61 timeout.init_timeout = server->timeo;
62 timeout.max_timeout = maxtimeo = NFS_MAX_RPC_TIMEOUT*HZ/10;
63 timeout.retries = server->retrans;
64 timeout.exponential = 1;
65
66 oldmask = current->blocked;
67 current->blocked |= ~(_S(SIGKILL)
68 | ((server->flags & NFS_MOUNT_INTR)
69 ? ((current->sig->action[SIGINT - 1].sa_handler == SIG_DFL
70 ? _S(SIGINT) : 0)
71 | (current->sig->action[SIGQUIT - 1].sa_handler == SIG_DFL
72 ? _S(SIGQUIT) : 0))
73 : 0));
74 major_timeout_seen = 0;
75
76 do {
77 result = rpc_call(server->rsock,
78 &server->toaddr, sizeof(server->toaddr),
79 start, ((char *) end) - ((char *) start),
80 start, size + 1024,
81 &timeout, 1);
82 if (current->signal & ~current->blocked)
83 result = -ERESTARTSYS;
84 if (result == -ETIMEDOUT) {
85 if (server->flags & NFS_MOUNT_SOFT) {
86 printk("NFS server %s not responding, "
87 "still trying.\n", server->hostname);
88 result = -EIO;
89 break;
90 }
91 if (!major_timeout_seen) {
92 printk("NFS server %s not responding, "
93 "timed out.\n", server->hostname);
94 major_timeout_seen = 1;
95 }
96 if ((timeout.init_timeout <<= 1) >= maxtimeo)
97 timeout.init_timeout = maxtimeo;
98 } else if (result < 0) {
99 printk("NFS: notice message: result = %d.\n", result);
100 }
101 } while (result == -ETIMEDOUT && !(server->flags & NFS_MOUNT_SOFT));
102
103 if (result >= 0 && major_timeout_seen)
104 printk("NFS server %s OK.\n", server->hostname);
105
106 if (result >= 0 && result < 20) {
107 printk("NFS: too small read memory size (%d bytes)\n", result);
108 result = -EIO;
109 }
110
111 current->blocked = oldmask;
112 return result;
113 }