summaryrefslogtreecommitdiff
blob: 5f3830c8ffe1bbe51b197913d06ae2a31fa0fa24 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
diff -u --recursive --new-file linux-2.4.6-file/fs/nfs/inode.c linux-2.4.6-mmap/fs/nfs/inode.c
--- linux-2.4.6-file/fs/nfs/inode.c	Wed Jul  4 17:30:28 2001
+++ linux-2.4.6-mmap/fs/nfs/inode.c	Wed Jul  4 20:48:01 2001
@@ -48,6 +48,7 @@
 static void nfs_write_inode(struct inode *,int);
 static void nfs_delete_inode(struct inode *);
 static void nfs_put_super(struct super_block *);
+static void nfs_clear_inode(struct inode *);
 static void nfs_umount_begin(struct super_block *);
 static int  nfs_statfs(struct super_block *, struct statfs *);
 
@@ -57,6 +58,7 @@
 	delete_inode:	nfs_delete_inode,
 	put_super:	nfs_put_super,
 	statfs:		nfs_statfs,
+	clear_inode:	nfs_clear_inode,
 	umount_begin:	nfs_umount_begin,
 };
 
@@ -141,6 +143,21 @@
 	clear_inode(inode);
 }
 
+/*
+ * For the moment, the only task for the NFS clear_inode method is to
+ * release the mmap credential
+ */
+static void
+nfs_clear_inode(struct inode *inode)
+{
+	struct rpc_cred *cred = NFS_I(inode)->mm_cred;
+
+	if (cred) {
+		put_rpccred(cred);
+		NFS_I(inode)->mm_cred = 0;
+	}
+}
+
 void
 nfs_put_super(struct super_block *sb)
 {
@@ -600,7 +617,6 @@
 		inode->i_ctime = nfs_time_to_secs(fattr->ctime);
 		NFS_CACHE_CTIME(inode) = fattr->ctime;
 		NFS_CACHE_MTIME(inode) = fattr->mtime;
-		NFS_CACHE_ATIME(inode) = fattr->atime;
 		NFS_CACHE_ISIZE(inode) = fattr->size;
 		NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
 		NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
@@ -794,6 +810,20 @@
 }
 
 /*
+ * Ensure that mmap has a recent RPC credential for use when writing out
+ * shared pages
+ */
+static inline void
+nfs_set_mmcred(struct inode *inode, struct rpc_cred *cred)
+{
+	struct rpc_cred *oldcred = NFS_I(inode)->mm_cred;
+
+	NFS_I(inode)->mm_cred = get_rpccred(cred);
+	if (oldcred)
+		put_rpccred(oldcred);
+}
+
+/*
  * These are probably going to contain hooks for
  * allocating and releasing RPC credentials for
  * the file. I'll have to think about Tronds patch
@@ -808,20 +838,20 @@
 	auth = NFS_CLIENT(inode)->cl_auth;
 	cred = rpcauth_lookupcred(auth, 0);
 	filp->private_data = cred;
+	if (filp->f_mode & FMODE_WRITE)
+		nfs_set_mmcred(inode, cred);
 	unlock_kernel();
 	return 0;
 }
 
 int nfs_release(struct inode *inode, struct file *filp)
 {
-	struct rpc_auth *auth;
 	struct rpc_cred *cred;
 
 	lock_kernel();
-	auth = NFS_CLIENT(inode)->cl_auth;
 	cred = nfs_file_cred(filp);
 	if (cred)
-		rpcauth_releasecred(auth, cred);
+		put_rpccred(cred);
 	unlock_kernel();
 	return 0;
 }
@@ -976,7 +1006,6 @@
 	NFS_CACHE_CTIME(inode) = fattr->ctime;
 	inode->i_ctime = nfs_time_to_secs(fattr->ctime);
 
-	NFS_CACHE_ATIME(inode) = fattr->atime;
 	inode->i_atime = nfs_time_to_secs(fattr->atime);
 
 	NFS_CACHE_MTIME(inode) = new_mtime;
diff -u --recursive --new-file linux-2.4.6-file/fs/nfs/unlink.c linux-2.4.6-mmap/fs/nfs/unlink.c
--- linux-2.4.6-file/fs/nfs/unlink.c	Fri Feb  9 20:29:44 2001
+++ linux-2.4.6-mmap/fs/nfs/unlink.c	Wed Jul  4 20:48:47 2001
@@ -128,7 +128,7 @@
 	dir_i = dir->d_inode;
 	nfs_zap_caches(dir_i);
 	NFS_PROTO(dir_i)->unlink_done(dir, &task->tk_msg);
-	rpcauth_releasecred(task->tk_auth, data->cred);
+	put_rpccred(data->cred);
 	data->cred = NULL;
 	dput(dir);
 }
diff -u --recursive --new-file linux-2.4.6-file/fs/nfs/write.c linux-2.4.6-mmap/fs/nfs/write.c
--- linux-2.4.6-file/fs/nfs/write.c	Mon May 21 21:29:14 2001
+++ linux-2.4.6-mmap/fs/nfs/write.c	Wed Jul  4 20:48:24 2001
@@ -181,7 +181,9 @@
 
 
 	if (file)
-		cred = nfs_file_cred(file);
+		cred = get_rpccred(nfs_file_cred(file));
+	if (!cred)
+		cred = get_rpccred(NFS_I(inode)->mm_cred);
 
 	dprintk("NFS:      nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
 		inode->i_dev, (long long)NFS_FILEID(inode),
@@ -226,6 +228,8 @@
 
 io_error:
 	kunmap(page);
+	if (cred)
+		put_rpccred(cred);
 
 	return written? written : result;
 }
@@ -241,6 +245,9 @@
 	status = (IS_ERR(req)) ? PTR_ERR(req) : 0;
 	if (status < 0)
 		goto out;
+	if (!req->wb_cred)
+		req->wb_cred = get_rpccred(NFS_I(inode)->mm_cred);
+	nfs_unlock_request(req);
 	nfs_release_request(req);
 	nfs_strategy(inode);
  out:
@@ -557,13 +564,11 @@
 	req->wb_bytes   = count;
 	req->wb_file    = file;
 
-	/* If we have a struct file, use its cached credentials
-	 * else cache the current process' credentials. */
+	/* If we have a struct file, use its cached credentials */
 	if (file) {
 		get_file(file);
 		req->wb_cred	= nfs_file_cred(file);
-	} else
-		req->wb_cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
+	}
 	req->wb_inode   = inode;
 	req->wb_count   = 1;
 
@@ -608,8 +613,8 @@
 	/* Release struct file or cached credential */
 	if (req->wb_file)
 		fput(req->wb_file);
-	else
-		rpcauth_releasecred(NFS_CLIENT(inode)->cl_auth, req->wb_cred);
+	else if (req->wb_cred)
+		put_rpccred(req->wb_cred);
 	page_cache_release(page);
 	nfs_page_free(req);
 	/* wake up anyone waiting to allocate a request */
@@ -927,8 +932,6 @@
 	if (end > rqend)
 		req->wb_bytes = end - req->wb_offset;
 
-	nfs_unlock_request(req);
-
 	return req;
 }
 
@@ -1049,6 +1052,7 @@
 		goto done;
 
 	status = 0;
+	nfs_unlock_request(req);
 	/* If we wrote past the end of the page.
 	 * Call the strategy routine so it can send out a bunch
 	 * of requests.
diff -u --recursive --new-file linux-2.4.6-file/include/linux/nfs_fs.h linux-2.4.6-mmap/include/linux/nfs_fs.h
--- linux-2.4.6-file/include/linux/nfs_fs.h	Sat May 26 03:02:11 2001
+++ linux-2.4.6-mmap/include/linux/nfs_fs.h	Wed Jul  4 17:32:16 2001
@@ -63,6 +63,11 @@
  */
 #define NFS_SUPER_MAGIC			0x6969
 
+static inline struct nfs_inode_info *NFS_I(struct inode *inode)
+{
+	return &inode->u.nfs_i;
+}
+
 #define NFS_FH(inode)			(&(inode)->u.nfs_i.fh)
 #define NFS_SERVER(inode)		(&(inode)->i_sb->u.nfs_sb.s_server)
 #define NFS_CLIENT(inode)		(NFS_SERVER(inode)->client)
@@ -74,7 +79,6 @@
 #define NFS_READTIME(inode)		((inode)->u.nfs_i.read_cache_jiffies)
 #define NFS_CACHE_CTIME(inode)		((inode)->u.nfs_i.read_cache_ctime)
 #define NFS_CACHE_MTIME(inode)		((inode)->u.nfs_i.read_cache_mtime)
-#define NFS_CACHE_ATIME(inode)		((inode)->u.nfs_i.read_cache_atime)
 #define NFS_CACHE_ISIZE(inode)		((inode)->u.nfs_i.read_cache_isize)
 #define NFS_NEXTSCAN(inode)		((inode)->u.nfs_i.nextscan)
 #define NFS_CACHEINV(inode) \
diff -u --recursive --new-file linux-2.4.6-file/include/linux/nfs_fs_i.h linux-2.4.6-mmap/include/linux/nfs_fs_i.h
--- linux-2.4.6-file/include/linux/nfs_fs_i.h	Thu May 31 15:27:10 2001
+++ linux-2.4.6-mmap/include/linux/nfs_fs_i.h	Wed Jul  4 17:32:16 2001
@@ -45,7 +45,6 @@
 	unsigned long		read_cache_jiffies;
 	__u64			read_cache_ctime;
 	__u64			read_cache_mtime;
-	__u64			read_cache_atime;
 	__u64			read_cache_isize;
 	unsigned long		attrtimeo;
 	unsigned long		attrtimeo_timestamp;
@@ -73,6 +72,9 @@
 	struct inode		*hash_next,
 				*hash_prev;
 	unsigned long		nextscan;
+
+	/* Credentials for shared mmap */
+	struct rpc_cred		*mm_cred;
 };
 
 /*
diff -u --recursive --new-file linux-2.4.6-file/include/linux/sunrpc/auth.h linux-2.4.6-mmap/include/linux/sunrpc/auth.h
--- linux-2.4.6-file/include/linux/sunrpc/auth.h	Fri Jun 22 19:30:22 2001
+++ linux-2.4.6-mmap/include/linux/sunrpc/auth.h	Wed Jul  4 20:51:35 2001
@@ -14,6 +14,8 @@
 #include <linux/config.h>
 #include <linux/sunrpc/sched.h>
 
+#include <asm/atomic.h>
+
 /* size of the nodename buffer */
 #define UNX_MAXNODENAME	32
 
@@ -22,8 +24,10 @@
  */
 struct rpc_cred {
 	struct rpc_cred *	cr_next;	/* linked list */
+	struct rpc_auth *	cr_auth;
+	struct rpc_credops *	cr_ops;
 	unsigned long		cr_expire;	/* when to gc */
-	unsigned short		cr_count;	/* ref count */
+	atomic_t		cr_count;	/* ref count */
 	unsigned short		cr_flags;	/* various flags */
 #ifdef RPC_DEBUG
 	unsigned long		cr_magic;	/* 0x0f4aa4f0 */
@@ -71,6 +75,9 @@
 	void			(*destroy)(struct rpc_auth *);
 
 	struct rpc_cred *	(*crcreate)(int);
+};
+
+struct rpc_credops {
 	void			(*crdestroy)(struct rpc_cred *);
 
 	int			(*crmatch)(struct rpc_cred *, int);
@@ -92,8 +99,7 @@
 struct rpc_cred *	rpcauth_lookupcred(struct rpc_auth *, int);
 struct rpc_cred *	rpcauth_bindcred(struct rpc_task *);
 void			rpcauth_holdcred(struct rpc_task *);
-void			rpcauth_releasecred(struct rpc_auth *,
-					    struct rpc_cred *);
+void			put_rpccred(struct rpc_cred *);
 void			rpcauth_unbindcred(struct rpc_task *);
 int			rpcauth_matchcred(struct rpc_auth *,
 					  struct rpc_cred *, int);
@@ -106,6 +112,13 @@
 void			rpcauth_free_credcache(struct rpc_auth *);
 void			rpcauth_insert_credcache(struct rpc_auth *,
 						struct rpc_cred *);
+
+static inline
+struct rpc_cred *	get_rpccred(struct rpc_cred *cred)
+{
+	atomic_inc(&cred->cr_count);
+	return cred;
+}
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SUNRPC_AUTH_H */
diff -u --recursive --new-file linux-2.4.6-file/net/sunrpc/auth.c linux-2.4.6-mmap/net/sunrpc/auth.c
--- linux-2.4.6-file/net/sunrpc/auth.c	Fri Feb  9 20:29:44 2001
+++ linux-2.4.6-mmap/net/sunrpc/auth.c	Wed Jul  4 20:51:04 2001
@@ -81,42 +81,61 @@
 	auth->au_nextgc = jiffies + (auth->au_expire >> 1);
 }
 
+/*
+ * Destroy an unreferenced credential
+ */
 static inline void
-rpcauth_crdestroy(struct rpc_auth *auth, struct rpc_cred *cred)
+rpcauth_crdestroy(struct rpc_cred *cred)
 {
 #ifdef RPC_DEBUG
 	if (cred->cr_magic != RPCAUTH_CRED_MAGIC)
 		BUG();
 	cred->cr_magic = 0;
+	if (atomic_read(&cred->cr_count) || cred->cr_auth)
+		BUG();
 #endif
-	if (auth->au_ops->crdestroy)
-		auth->au_ops->crdestroy(cred);
-	else
-		rpc_free(cred);
+	cred->cr_ops->crdestroy(cred);
 }
 
 /*
- * Clear the RPC credential cache
+ * Destroy a list of credentials
+ */
+static inline
+void rpcauth_destroy_credlist(struct rpc_cred *head)
+{
+	struct rpc_cred *cred;
+
+	while ((cred = head) != NULL) {
+		head = cred->cr_next;
+		rpcauth_crdestroy(cred);
+	}
+}
+
+/*
+ * Clear the RPC credential cache, and delete those credentials
+ * that are not referenced.
  */
 void
 rpcauth_free_credcache(struct rpc_auth *auth)
 {
-	struct rpc_cred	**q, *cred;
-	void		(*destroy)(struct rpc_cred *);
+	struct rpc_cred	**q, *cred, *free = NULL;
 	int		i;
 
-	if (!(destroy = auth->au_ops->crdestroy))
-		destroy = (void (*)(struct rpc_cred *)) rpc_free;
-
 	spin_lock(&rpc_credcache_lock);
 	for (i = 0; i < RPC_CREDCACHE_NR; i++) {
 		q = &auth->au_credcache[i];
 		while ((cred = *q) != NULL) {
 			*q = cred->cr_next;
-			destroy(cred);
+			cred->cr_auth = NULL;
+			if (atomic_read(&cred->cr_count) == 0) {
+				cred->cr_next = free;
+				free = cred;
+			} else
+				cred->cr_next = NULL;
 		}
 	}
 	spin_unlock(&rpc_credcache_lock);
+	rpcauth_destroy_credlist(free);
 }
 
 /*
@@ -133,9 +152,10 @@
 	for (i = 0; i < RPC_CREDCACHE_NR; i++) {
 		q = &auth->au_credcache[i];
 		while ((cred = *q) != NULL) {
-			if (!cred->cr_count &&
+			if (!atomic_read(&cred->cr_count) &&
 			    time_before(cred->cr_expire, jiffies)) {
 				*q = cred->cr_next;
+				cred->cr_auth = NULL;
 				cred->cr_next = free;
 				free = cred;
 				continue;
@@ -144,10 +164,7 @@
 		}
 	}
 	spin_unlock(&rpc_credcache_lock);
-	while ((cred = free) != NULL) {
-		free = cred->cr_next;
-		rpcauth_crdestroy(auth, cred);
-	}
+	rpcauth_destroy_credlist(free);
 	auth->au_nextgc = jiffies + auth->au_expire;
 }
 
@@ -163,8 +180,8 @@
 	spin_lock(&rpc_credcache_lock);
 	cred->cr_next = auth->au_credcache[nr];
 	auth->au_credcache[nr] = cred;
-	cred->cr_count++;
-	cred->cr_expire = jiffies + auth->au_expire;
+	cred->cr_auth = auth;
+	get_rpccred(cred);
 	spin_unlock(&rpc_credcache_lock);
 }
 
@@ -187,7 +204,7 @@
 	q = &auth->au_credcache[nr];
 	while ((cred = *q) != NULL) {
 		if (!(cred->cr_flags & RPCAUTH_CRED_DEAD) &&
-		    auth->au_ops->crmatch(cred, taskflags)) {
+		    cred->cr_ops->crmatch(cred, taskflags)) {
 			*q = cred->cr_next;
 			break;
 		}
@@ -213,23 +230,23 @@
  * Remove cred handle from cache
  */
 static void
-rpcauth_remove_credcache(struct rpc_auth *auth, struct rpc_cred *cred)
+rpcauth_remove_credcache(struct rpc_cred *cred)
 {
+	struct rpc_auth *auth = cred->cr_auth;
 	struct rpc_cred	**q, *cr;
 	int		nr;
 
 	nr = (cred->cr_uid & RPC_CREDCACHE_MASK);
-	spin_lock(&rpc_credcache_lock);
 	q = &auth->au_credcache[nr];
 	while ((cr = *q) != NULL) {
 		if (cred == cr) {
 			*q = cred->cr_next;
 			cred->cr_next = NULL;
+			cred->cr_auth = NULL;
 			break;
 		}
 		q = &cred->cr_next;
 	}
-	spin_unlock(&rpc_credcache_lock);
 }
 
 struct rpc_cred *
@@ -258,7 +275,7 @@
 {
 	dprintk("RPC:     matching %s cred %d\n",
 		auth->au_ops->au_name, taskflags);
-	return auth->au_ops->crmatch(cred, taskflags);
+	return cred->cr_ops->crmatch(cred, taskflags);
 }
 
 void
@@ -266,26 +283,25 @@
 {
 	dprintk("RPC: %4d holding %s cred %p\n",
 		task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred);
-	if (task->tk_msg.rpc_cred) {
-		spin_lock(&rpc_credcache_lock);
-		task->tk_msg.rpc_cred->cr_count++;
-		task->tk_msg.rpc_cred->cr_expire = jiffies + task->tk_auth->au_expire;
-		spin_unlock(&rpc_credcache_lock);
-	}
+	if (task->tk_msg.rpc_cred)
+		get_rpccred(task->tk_msg.rpc_cred);
 }
 
 void
-rpcauth_releasecred(struct rpc_auth *auth, struct rpc_cred *cred)
+put_rpccred(struct rpc_cred *cred)
 {
-	spin_lock(&rpc_credcache_lock);
-	if (cred != NULL && cred->cr_count > 0) {
-		if (!--cred->cr_count && (cred->cr_flags & RPCAUTH_CRED_DEAD)) {
-			spin_unlock(&rpc_credcache_lock);
-			rpcauth_remove_credcache(auth, cred);
-			rpcauth_crdestroy(auth, cred);
-			return;
-		}
+	if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock))
+		return;
+
+	if (cred->cr_auth && cred->cr_flags & RPCAUTH_CRED_DEAD)
+		rpcauth_remove_credcache(cred);
+
+	if (!cred->cr_auth) {
+		spin_unlock(&rpc_credcache_lock);
+		rpcauth_crdestroy(cred);
+		return;
 	}
+	cred->cr_expire = jiffies + cred->cr_auth->au_expire;
 	spin_unlock(&rpc_credcache_lock);
 }
 
@@ -298,7 +314,7 @@
 	dprintk("RPC: %4d releasing %s cred %p\n",
 		task->tk_pid, auth->au_ops->au_name, cred);
 
-	rpcauth_releasecred(auth, cred);
+	put_rpccred(cred);
 	task->tk_msg.rpc_cred = NULL;
 }
 
@@ -306,10 +322,11 @@
 rpcauth_marshcred(struct rpc_task *task, u32 *p)
 {
 	struct rpc_auth	*auth = task->tk_auth;
+	struct rpc_cred	*cred = task->tk_msg.rpc_cred;
 
 	dprintk("RPC: %4d marshaling %s cred %p\n",
-		task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
-	return auth->au_ops->crmarshal(task, p,
+		task->tk_pid, auth->au_ops->au_name, cred);
+	return cred->cr_ops->crmarshal(task, p,
 				task->tk_flags & RPC_CALL_REALUID);
 }
 
@@ -317,20 +334,22 @@
 rpcauth_checkverf(struct rpc_task *task, u32 *p)
 {
 	struct rpc_auth	*auth = task->tk_auth;
+	struct rpc_cred	*cred = task->tk_msg.rpc_cred;
 
 	dprintk("RPC: %4d validating %s cred %p\n",
-		task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
-	return auth->au_ops->crvalidate(task, p);
+		task->tk_pid, auth->au_ops->au_name, cred);
+	return cred->cr_ops->crvalidate(task, p);
 }
 
 int
 rpcauth_refreshcred(struct rpc_task *task)
 {
 	struct rpc_auth	*auth = task->tk_auth;
+	struct rpc_cred	*cred = task->tk_msg.rpc_cred;
 
 	dprintk("RPC: %4d refreshing %s cred %p\n",
-		task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
-	task->tk_status = auth->au_ops->crrefresh(task);
+		task->tk_pid, auth->au_ops->au_name, cred);
+	task->tk_status = cred->cr_ops->crrefresh(task);
 	return task->tk_status;
 }
 
diff -u --recursive --new-file linux-2.4.6-file/net/sunrpc/auth_null.c linux-2.4.6-mmap/net/sunrpc/auth_null.c
--- linux-2.4.6-file/net/sunrpc/auth_null.c	Fri Feb  9 20:29:44 2001
+++ linux-2.4.6-mmap/net/sunrpc/auth_null.c	Wed Jul  4 19:27:38 2001
@@ -17,6 +17,8 @@
 # define RPCDBG_FACILITY	RPCDBG_AUTH
 #endif
 
+static struct rpc_credops	null_credops;
+
 static struct rpc_auth *
 nul_create(struct rpc_clnt *clnt)
 {
@@ -52,9 +54,10 @@
 
 	if (!(cred = (struct rpc_cred *) rpc_allocate(flags, sizeof(*cred))))
 		return NULL;
-	cred->cr_count = 0;
+	atomic_set(&cred->cr_count, 0);
 	cred->cr_flags = RPCAUTH_CRED_UPTODATE;
 	cred->cr_uid = current->uid;
+	cred->cr_ops = &null_credops;
 
 	return cred;
 }
@@ -124,7 +127,11 @@
 #endif
 	nul_create,
 	nul_destroy,
-	nul_create_cred,
+	nul_create_cred
+};
+
+static
+struct rpc_credops	null_credops = {
 	nul_destroy_cred,
 	nul_match,
 	nul_marshal,
diff -u --recursive --new-file linux-2.4.6-file/net/sunrpc/auth_unix.c linux-2.4.6-mmap/net/sunrpc/auth_unix.c
--- linux-2.4.6-file/net/sunrpc/auth_unix.c	Fri Feb  9 20:29:44 2001
+++ linux-2.4.6-mmap/net/sunrpc/auth_unix.c	Wed Jul  4 19:29:07 2001
@@ -33,6 +33,8 @@
 # define RPCDBG_FACILITY	RPCDBG_AUTH
 #endif
 
+static struct rpc_credops	unix_credops;
+
 static struct rpc_auth *
 unx_create(struct rpc_clnt *clnt)
 {
@@ -71,7 +73,7 @@
 	if (!(cred = (struct unx_cred *) rpc_allocate(flags, sizeof(*cred))))
 		return NULL;
 
-	cred->uc_count = 0;
+	atomic_set(&cred->uc_count, 0);
 	cred->uc_flags = RPCAUTH_CRED_UPTODATE;
 	if (flags & RPC_TASK_ROOTCREDS) {
 		cred->uc_uid = cred->uc_fsuid = 0;
@@ -91,6 +93,7 @@
 		if (i < NFS_NGROUPS)
 		  cred->uc_gids[i] = NOGROUP;
 	}
+	cred->uc_base.cr_ops = &unix_credops;
 
 	return (struct rpc_cred *) cred;
 }
@@ -106,7 +109,7 @@
 	if (!(cred = (struct unx_cred *) rpc_malloc(task, sizeof(*cred))))
 		return NULL;
 
-	cred->uc_count = 1;
+	atomic_set(&cred->uc_count, 1);
 	cred->uc_flags = RPCAUTH_CRED_DEAD|RPCAUTH_CRED_UPTODATE;
 	cred->uc_uid   = uid;
 	cred->uc_gid   = gid;
@@ -236,7 +239,11 @@
 #endif
 	unx_create,
 	unx_destroy,
-	unx_create_cred,
+	unx_create_cred
+};
+
+static
+struct rpc_credops	unix_credops = {
 	unx_destroy_cred,
 	unx_match,
 	unx_marshal,
diff -u --recursive --new-file linux-2.4.6-file/net/sunrpc/sunrpc_syms.c linux-2.4.6-mmap/net/sunrpc/sunrpc_syms.c
--- linux-2.4.6-file/net/sunrpc/sunrpc_syms.c	Fri Jan 12 00:53:02 2001
+++ linux-2.4.6-mmap/net/sunrpc/sunrpc_syms.c	Wed Jul  4 20:55:19 2001
@@ -65,7 +65,7 @@
 EXPORT_SYMBOL(rpcauth_lookupcred);
 EXPORT_SYMBOL(rpcauth_bindcred);
 EXPORT_SYMBOL(rpcauth_matchcred);
-EXPORT_SYMBOL(rpcauth_releasecred);
+EXPORT_SYMBOL(put_rpccred);
 
 /* RPC server stuff */
 EXPORT_SYMBOL(svc_create);

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/nfs