aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-18 17:20:12 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-18 17:20:12 -0400
commitcee54fc944422c44e476736c045a9e8053cb0644 (patch)
tree95f4728b3ffa8a2456727b10cd3a68f2a3065415 /include/linux
parent5e5ce5be6f0161d2a069a4f8a1154fe639c5c02f (diff)
NFSv4: Add functions to order RPC calls
NFSv4 file state-changing functions such as OPEN, CLOSE, LOCK,... are all labelled with "sequence identifiers" in order to prevent the server from reordering RPC requests, as this could cause its file state to become out of sync with the client. Currently the NFS client code enforces this ordering locally using semaphores to restrict access to structures until the RPC call is done. This, of course, only works with synchronous RPC calls, since the user process must first grab the semaphore. By dropping semaphores, and instead teaching the RPC engine to hold the RPC calls until they are ready to be sent, we can extend this process to work nicely with asynchronous RPC calls too. This patch adds a new list called "rpc_sequence" that defines the order of the RPC calls to be sent. We add one such list for each state_owner. When an RPC call is ready to be sent, it checks if it is top of the rpc_sequence list. If so, it proceeds. If not, it goes back to sleep, and loops until it hits top of the list. Once the RPC call has completed, it can then bump the sequence id counter, and remove itself from the rpc_sequence list, and then wake up the next sleeper. Note that the state_owner sequence ids and lock_owner sequence ids are all indexed to the same rpc_sequence list, so OPEN, LOCK,... requests are all ordered w.r.t. each other. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/nfs_xdr.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a2bf6914ff1b..d578912bf9a9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -96,12 +96,13 @@ struct nfs4_change_info {
96 u64 after; 96 u64 after;
97}; 97};
98 98
99struct nfs_seqid;
99/* 100/*
100 * Arguments to the open call. 101 * Arguments to the open call.
101 */ 102 */
102struct nfs_openargs { 103struct nfs_openargs {
103 const struct nfs_fh * fh; 104 const struct nfs_fh * fh;
104 __u32 seqid; 105 struct nfs_seqid * seqid;
105 int open_flags; 106 int open_flags;
106 __u64 clientid; 107 __u64 clientid;
107 __u32 id; 108 __u32 id;
@@ -136,7 +137,7 @@ struct nfs_openres {
136struct nfs_open_confirmargs { 137struct nfs_open_confirmargs {
137 const struct nfs_fh * fh; 138 const struct nfs_fh * fh;
138 nfs4_stateid stateid; 139 nfs4_stateid stateid;
139 __u32 seqid; 140 struct nfs_seqid * seqid;
140}; 141};
141 142
142struct nfs_open_confirmres { 143struct nfs_open_confirmres {
@@ -149,7 +150,7 @@ struct nfs_open_confirmres {
149struct nfs_closeargs { 150struct nfs_closeargs {
150 struct nfs_fh * fh; 151 struct nfs_fh * fh;
151 nfs4_stateid stateid; 152 nfs4_stateid stateid;
152 __u32 seqid; 153 struct nfs_seqid * seqid;
153 int open_flags; 154 int open_flags;
154}; 155};
155 156
@@ -165,15 +166,15 @@ struct nfs_lowner {
165}; 166};
166 167
167struct nfs_open_to_lock { 168struct nfs_open_to_lock {
168 __u32 open_seqid; 169 struct nfs_seqid * open_seqid;
169 nfs4_stateid open_stateid; 170 nfs4_stateid open_stateid;
170 __u32 lock_seqid; 171 struct nfs_seqid * lock_seqid;
171 struct nfs_lowner lock_owner; 172 struct nfs_lowner lock_owner;
172}; 173};
173 174
174struct nfs_exist_lock { 175struct nfs_exist_lock {
175 nfs4_stateid stateid; 176 nfs4_stateid stateid;
176 __u32 seqid; 177 struct nfs_seqid * seqid;
177}; 178};
178 179
179struct nfs_lock_opargs { 180struct nfs_lock_opargs {
@@ -186,7 +187,7 @@ struct nfs_lock_opargs {
186}; 187};
187 188
188struct nfs_locku_opargs { 189struct nfs_locku_opargs {
189 __u32 seqid; 190 struct nfs_seqid * seqid;
190 nfs4_stateid stateid; 191 nfs4_stateid stateid;
191}; 192};
192 193