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