summaryrefslogtreecommitdiffstats
path: root/proto/NFS_README.html
blob: 0f970ee82c883c5dfb2c3b17415ec1b00cc47771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Postfix and NFS</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body>

<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix and NFS</h1>

<hr>

<h2> Postfix support status for NFS </h2>

<p> What is the status of support for Postfix on NFS? The answer
is that Postfix itself is supported when you use NFS, but there is
no promise that an NFS-related problem will promptly receive a
Postfix workaround, or that a workaround will even be possible.
</p>

<p> That said, Postfix will in many cases work very well on NFS,
because Postfix implements a number of workarounds (see below).
Good NFS implementations seldom if ever give problems with Postfix,
so Wietse recommends that you spend your money wisely.  </p>

<h2> Postfix file locking and NFS </h2>

<p> For the Postfix mail queue, it does not matter how well NFS
file locking works. The reason is that you cannot share Postfix
queues among multiple running Postfix instances. You can use NFS
to switch a Postfix mail queue from one NFS client to another one,
but only one NFS client can access a Postfix mail queue at any
particular point in time. </p>

<p> For mailbox file sharing with NFS, your options are to use
<b>fcntl</b> (kernel locks), <b>dotlock</b> (<i>username</i>.lock
files), to use both locking methods simultaneously, or to switch
to maildir format. The maildir format uses one file per message and
needs no file locking support in Postfix or in other mail software.
</p>

<p> Many sites that use mailbox format play safe and use both locking
methods simultaneously. </p>

<blockquote>
<pre>
/etc/postfix/main.cf:
    virtual_mailbox_lock = fcntl, dotlock
    mailbox_delivery_lock = fcntl, dotlock
</pre>
</blockquote>

<h2> Postfix NFS workarounds </h2>

<p> The list below summarizes the workarounds that exist for running
Postfix on NFS as of the middle of 2003. As a reminder, Postfix
itself is still supported when it runs on NFS, but there is no
promise that an NFS-related problem will promptly receive a Postfix
workaround, or that a workaround will even be possible.  </p>

<ul>

<li> <p> Problem: when renaming a file, the operation may succeed
but report an error anyway<sup>[1]</sup>. </p>

<p> Workaround: when rename(old, new) reports an error, Postfix
checks if the new name exists and the old name is gone. If the check
succeeds, Postfix assumes that the rename() operation completed
normally.  </p>

<li> <p> Problem: when creating a directory, the operation may succeed
but report an error anyway<sup>[1]</sup>. </p>

<p> Workaround: when mkdir(new) reports an EEXIST error, Postfix
checks if the new name resolves to a directory. If the check succeeds,
Postfix assumes that the mkdir() operation completed normally.  </p>

<li> <p> Problem: when creating a hardlink to a file, the operation
may succeed but report an error anyway<sup>[1]</sup>. </p>

<p> Workaround: when link(old, new) fails, Postfix compares the
device and inode number of the old and new files. When the two files
are identical, Postfix assumes that the link() operation completed
normally. </p>

<li> <p> Problem: when creating a dotlock (<i>username</i>.lock)
file, the operation may succeed but report an error anyway<sup>[1]</sup>.
</p>

<p> Workaround: in this case, the only safe action is to back off
and try again later.  </p>

<li> <p> Problem: when a file server's "time of day" clock is not
synchronized with the client's "time of day" clock, email deliveries
are delayed by a minute or more.  </p>

<p> Workaround: Postfix explicitly sets file time stamps to avoid
delays with new mail (Postfix uses "last modified" file time stamps
to decide when a queue file is ready for delivery).  </p>

</ul>

<p> <sup>[1]</sup> How can an operation succeed and report an error
anyway? </p>

<p> Suppose that an NFS server executes a client request successfully,
and that the server's reply to the client is lost.  After some time
the client retransmits the request to the server.  Normally, the
server remembers that it already completed the request (it keeps a
list of recently-completed requests and replies), and simply
retransmits the reply. </p>

<p> However, when the server has rebooted or when it has been very
busy, the server no longer remembers that it already completed the
request, and repeats the operation.  This causes no problems with
file read/write requests (they contain a file offset and can therefore
be repeated safely), but fails with non-idempotent operations. For
example, when the server executes a retransmitted rename() request,
the server reports an ENOENT error because the old name does not
exist; and when the server executes a retransmitted link(), mkdir()
or create() request, the server reports an EEXIST error because the
name already exists. </p>

<p> Thus, successful, non-idempotent, NFS operations will report
false errors when the server reply is lost, the client retransmits
the request, and the server does not remember that it already
completed the request.  </p>

</body>
</html>