aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2007-05-09 05:33:45 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:50 -0400
commit416351f28d2b31d15ff73e9aff699b2163704c95 (patch)
tree4b43838415b2cb95dfc66f9bc5fdb36b0f245e6c
parentef71c15c46a053818f7e69098ebb052b31ffa56b (diff)
AFS: AFS fixups
Make some miscellaneous changes to the AFS filesystem: (1) Assert RCU barriers on module exit to make sure RCU has finished with callbacks in this module. (2) Correctly handle the AFS server returning a zero-length read. (3) Split out data zapping calls into one function (afs_zap_data). (4) Rename some afs_file_*() functions to afs_*() where they apply to non-regular files too. (5) Be consistent about the presentation of volume ID:vnode ID in debugging output. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/afs/callback.c9
-rw-r--r--fs/afs/dir.c18
-rw-r--r--fs/afs/file.c75
-rw-r--r--fs/afs/fsclient.c37
-rw-r--r--fs/afs/inode.c25
-rw-r--r--fs/afs/internal.h29
-rw-r--r--fs/afs/main.c2
-rw-r--r--fs/afs/misc.c1
-rw-r--r--fs/afs/mntpt.c5
-rw-r--r--fs/afs/security.c12
-rw-r--r--fs/afs/server.c3
-rw-r--r--fs/afs/vnode.c14
12 files changed, 121 insertions, 109 deletions
diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index 9bdbf36a9aa9..f64e40fefc02 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -44,7 +44,7 @@ void afs_init_callback_state(struct afs_server *server)
44 while (!RB_EMPTY_ROOT(&server->cb_promises)) { 44 while (!RB_EMPTY_ROOT(&server->cb_promises)) {
45 vnode = rb_entry(server->cb_promises.rb_node, 45 vnode = rb_entry(server->cb_promises.rb_node,
46 struct afs_vnode, cb_promise); 46 struct afs_vnode, cb_promise);
47 _debug("UNPROMISE { vid=%x vn=%u uq=%u}", 47 _debug("UNPROMISE { vid=%x:%u uq=%u}",
48 vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); 48 vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
49 rb_erase(&vnode->cb_promise, &server->cb_promises); 49 rb_erase(&vnode->cb_promise, &server->cb_promises);
50 vnode->cb_promised = false; 50 vnode->cb_promised = false;
@@ -84,11 +84,8 @@ void afs_broken_callback_work(struct work_struct *work)
84 84
85 /* if the vnode's data version number changed then its contents 85 /* if the vnode's data version number changed then its contents
86 * are different */ 86 * are different */
87 if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { 87 if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
88 _debug("zap data {%x:%u}", 88 afs_zap_data(vnode);
89 vnode->fid.vid, vnode->fid.vnode);
90 invalidate_remote_inode(&vnode->vfs_inode);
91 }
92 } 89 }
93 90
94out: 91out:
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 0c1e902f17a3..51f177af5dd6 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -55,7 +55,7 @@ const struct inode_operations afs_dir_inode_operations = {
55 .rmdir = afs_rmdir, 55 .rmdir = afs_rmdir,
56 .rename = afs_rename, 56 .rename = afs_rename,
57 .permission = afs_permission, 57 .permission = afs_permission,
58 .getattr = afs_inode_getattr, 58 .getattr = afs_getattr,
59}; 59};
60 60
61static struct dentry_operations afs_fs_dentry_operations = { 61static struct dentry_operations afs_fs_dentry_operations = {
@@ -491,7 +491,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
491 491
492 vnode = AFS_FS_I(dir); 492 vnode = AFS_FS_I(dir);
493 493
494 _enter("{%x:%d},%p{%s},", 494 _enter("{%x:%u},%p{%s},",
495 vnode->fid.vid, vnode->fid.vnode, dentry, dentry->d_name.name); 495 vnode->fid.vid, vnode->fid.vnode, dentry, dentry->d_name.name);
496 496
497 ASSERTCMP(dentry->d_inode, ==, NULL); 497 ASSERTCMP(dentry->d_inode, ==, NULL);
@@ -731,7 +731,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
731 731
732 dvnode = AFS_FS_I(dir); 732 dvnode = AFS_FS_I(dir);
733 733
734 _enter("{%x:%d},{%s},%o", 734 _enter("{%x:%u},{%s},%o",
735 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); 735 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
736 736
737 ret = -ENAMETOOLONG; 737 ret = -ENAMETOOLONG;
@@ -796,7 +796,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
796 796
797 dvnode = AFS_FS_I(dir); 797 dvnode = AFS_FS_I(dir);
798 798
799 _enter("{%x:%d},{%s}", 799 _enter("{%x:%u},{%s}",
800 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name); 800 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
801 801
802 ret = -ENAMETOOLONG; 802 ret = -ENAMETOOLONG;
@@ -842,7 +842,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
842 842
843 dvnode = AFS_FS_I(dir); 843 dvnode = AFS_FS_I(dir);
844 844
845 _enter("{%x:%d},{%s}", 845 _enter("{%x:%u},{%s}",
846 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name); 846 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
847 847
848 ret = -ENAMETOOLONG; 848 ret = -ENAMETOOLONG;
@@ -916,7 +916,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode,
916 916
917 dvnode = AFS_FS_I(dir); 917 dvnode = AFS_FS_I(dir);
918 918
919 _enter("{%x:%d},{%s},%o,", 919 _enter("{%x:%u},{%s},%o,",
920 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); 920 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
921 921
922 ret = -ENAMETOOLONG; 922 ret = -ENAMETOOLONG;
@@ -983,7 +983,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
983 vnode = AFS_FS_I(from->d_inode); 983 vnode = AFS_FS_I(from->d_inode);
984 dvnode = AFS_FS_I(dir); 984 dvnode = AFS_FS_I(dir);
985 985
986 _enter("{%x:%d},{%x:%d},{%s}", 986 _enter("{%x:%u},{%x:%u},{%s}",
987 vnode->fid.vid, vnode->fid.vnode, 987 vnode->fid.vid, vnode->fid.vnode,
988 dvnode->fid.vid, dvnode->fid.vnode, 988 dvnode->fid.vid, dvnode->fid.vnode,
989 dentry->d_name.name); 989 dentry->d_name.name);
@@ -1032,7 +1032,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
1032 1032
1033 dvnode = AFS_FS_I(dir); 1033 dvnode = AFS_FS_I(dir);
1034 1034
1035 _enter("{%x:%d},{%s},%s", 1035 _enter("{%x:%u},{%s},%s",
1036 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, 1036 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name,
1037 content); 1037 content);
1038 1038
@@ -1104,7 +1104,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
1104 orig_dvnode = AFS_FS_I(old_dir); 1104 orig_dvnode = AFS_FS_I(old_dir);
1105 new_dvnode = AFS_FS_I(new_dir); 1105 new_dvnode = AFS_FS_I(new_dir);
1106 1106
1107 _enter("{%x:%d},{%x:%d},{%x:%d},{%s}", 1107 _enter("{%x:%u},{%x:%u},{%x:%u},{%s}",
1108 orig_dvnode->fid.vid, orig_dvnode->fid.vnode, 1108 orig_dvnode->fid.vid, orig_dvnode->fid.vnode,
1109 vnode->fid.vid, vnode->fid.vnode, 1109 vnode->fid.vid, vnode->fid.vnode,
1110 new_dvnode->fid.vid, new_dvnode->fid.vnode, 1110 new_dvnode->fid.vid, new_dvnode->fid.vnode,
diff --git a/fs/afs/file.c b/fs/afs/file.c
index ae256498f4f7..3eb3fc7b36be 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -17,9 +17,9 @@
17#include <linux/pagemap.h> 17#include <linux/pagemap.h>
18#include "internal.h" 18#include "internal.h"
19 19
20static int afs_file_readpage(struct file *file, struct page *page); 20static int afs_readpage(struct file *file, struct page *page);
21static void afs_file_invalidatepage(struct page *page, unsigned long offset); 21static void afs_invalidatepage(struct page *page, unsigned long offset);
22static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); 22static int afs_releasepage(struct page *page, gfp_t gfp_flags);
23 23
24const struct file_operations afs_file_operations = { 24const struct file_operations afs_file_operations = {
25 .open = afs_open, 25 .open = afs_open,
@@ -32,15 +32,15 @@ const struct file_operations afs_file_operations = {
32}; 32};
33 33
34const struct inode_operations afs_file_inode_operations = { 34const struct inode_operations afs_file_inode_operations = {
35 .getattr = afs_inode_getattr, 35 .getattr = afs_getattr,
36 .permission = afs_permission, 36 .permission = afs_permission,
37}; 37};
38 38
39const struct address_space_operations afs_fs_aops = { 39const struct address_space_operations afs_fs_aops = {
40 .readpage = afs_file_readpage, 40 .readpage = afs_readpage,
41 .set_page_dirty = __set_page_dirty_nobuffers, 41 .set_page_dirty = __set_page_dirty_nobuffers,
42 .releasepage = afs_file_releasepage, 42 .releasepage = afs_releasepage,
43 .invalidatepage = afs_file_invalidatepage, 43 .invalidatepage = afs_invalidatepage,
44}; 44};
45 45
46/* 46/*
@@ -52,7 +52,7 @@ int afs_open(struct inode *inode, struct file *file)
52 struct key *key; 52 struct key *key;
53 int ret; 53 int ret;
54 54
55 _enter("{%x:%x},", vnode->fid.vid, vnode->fid.vnode); 55 _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
56 56
57 key = afs_request_key(vnode->volume->cell); 57 key = afs_request_key(vnode->volume->cell);
58 if (IS_ERR(key)) { 58 if (IS_ERR(key)) {
@@ -78,7 +78,7 @@ int afs_release(struct inode *inode, struct file *file)
78{ 78{
79 struct afs_vnode *vnode = AFS_FS_I(inode); 79 struct afs_vnode *vnode = AFS_FS_I(inode);
80 80
81 _enter("{%x:%x},", vnode->fid.vid, vnode->fid.vnode); 81 _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
82 82
83 key_put(file->private_data); 83 key_put(file->private_data);
84 _leave(" = 0"); 84 _leave(" = 0");
@@ -89,10 +89,10 @@ int afs_release(struct inode *inode, struct file *file)
89 * deal with notification that a page was read from the cache 89 * deal with notification that a page was read from the cache
90 */ 90 */
91#ifdef AFS_CACHING_SUPPORT 91#ifdef AFS_CACHING_SUPPORT
92static void afs_file_readpage_read_complete(void *cookie_data, 92static void afs_readpage_read_complete(void *cookie_data,
93 struct page *page, 93 struct page *page,
94 void *data, 94 void *data,
95 int error) 95 int error)
96{ 96{
97 _enter("%p,%p,%p,%d", cookie_data, page, data, error); 97 _enter("%p,%p,%p,%d", cookie_data, page, data, error);
98 98
@@ -109,10 +109,10 @@ static void afs_file_readpage_read_complete(void *cookie_data,
109 * deal with notification that a page was written to the cache 109 * deal with notification that a page was written to the cache
110 */ 110 */
111#ifdef AFS_CACHING_SUPPORT 111#ifdef AFS_CACHING_SUPPORT
112static void afs_file_readpage_write_complete(void *cookie_data, 112static void afs_readpage_write_complete(void *cookie_data,
113 struct page *page, 113 struct page *page,
114 void *data, 114 void *data,
115 int error) 115 int error)
116{ 116{
117 _enter("%p,%p,%p,%d", cookie_data, page, data, error); 117 _enter("%p,%p,%p,%d", cookie_data, page, data, error);
118 118
@@ -121,9 +121,9 @@ static void afs_file_readpage_write_complete(void *cookie_data,
121#endif 121#endif
122 122
123/* 123/*
124 * AFS read page from file (or symlink) 124 * AFS read page from file, directory or symlink
125 */ 125 */
126static int afs_file_readpage(struct file *file, struct page *page) 126static int afs_readpage(struct file *file, struct page *page)
127{ 127{
128 struct afs_vnode *vnode; 128 struct afs_vnode *vnode;
129 struct inode *inode; 129 struct inode *inode;
@@ -219,30 +219,13 @@ error:
219} 219}
220 220
221/* 221/*
222 * get a page cookie for the specified page
223 */
224#ifdef AFS_CACHING_SUPPORT
225int afs_cache_get_page_cookie(struct page *page,
226 struct cachefs_page **_page_cookie)
227{
228 int ret;
229
230 _enter("");
231 ret = cachefs_page_get_private(page,_page_cookie, GFP_NOIO);
232
233 _leave(" = %d", ret);
234 return ret;
235}
236#endif
237
238/*
239 * invalidate part or all of a page 222 * invalidate part or all of a page
240 */ 223 */
241static void afs_file_invalidatepage(struct page *page, unsigned long offset) 224static void afs_invalidatepage(struct page *page, unsigned long offset)
242{ 225{
243 int ret = 1; 226 int ret = 1;
244 227
245 _enter("{%lu},%lu", page->index, offset); 228 kenter("{%lu},%lu", page->index, offset);
246 229
247 BUG_ON(!PageLocked(page)); 230 BUG_ON(!PageLocked(page));
248 231
@@ -274,23 +257,17 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset)
274/* 257/*
275 * release a page and cleanup its private data 258 * release a page and cleanup its private data
276 */ 259 */
277static int afs_file_releasepage(struct page *page, gfp_t gfp_flags) 260static int afs_releasepage(struct page *page, gfp_t gfp_flags)
278{ 261{
279 struct cachefs_page *pageio; 262 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
280 263
281 _enter("{%lu},%x", page->index, gfp_flags); 264 _enter("{{%x:%u}[%lu],%lx},%x",
265 vnode->fid.vid, vnode->fid.vnode, page->index, page->flags,
266 gfp_flags);
282 267
283 if (PagePrivate(page)) { 268 if (PagePrivate(page)) {
284#ifdef AFS_CACHING_SUPPORT
285 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
286 cachefs_uncache_page(vnode->cache, page);
287#endif
288
289 pageio = (struct cachefs_page *) page_private(page);
290 set_page_private(page, 0); 269 set_page_private(page, 0);
291 ClearPagePrivate(page); 270 ClearPagePrivate(page);
292
293 kfree(pageio);
294 } 271 }
295 272
296 _leave(" = 0"); 273 _leave(" = 0");
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index e54e6c2ad343..1e65fee36413 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -206,7 +206,7 @@ int afs_fs_fetch_file_status(struct afs_server *server,
206 struct afs_call *call; 206 struct afs_call *call;
207 __be32 *bp; 207 __be32 *bp;
208 208
209 _enter(",%x,{%x:%d},,", 209 _enter(",%x,{%x:%u},,",
210 key_serial(key), vnode->fid.vid, vnode->fid.vnode); 210 key_serial(key), vnode->fid.vid, vnode->fid.vnode);
211 211
212 call = afs_alloc_flat_call(&afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4); 212 call = afs_alloc_flat_call(&afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4);
@@ -265,25 +265,20 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call,
265 call->offset = 0; 265 call->offset = 0;
266 call->unmarshall++; 266 call->unmarshall++;
267 267
268 if (call->count < PAGE_SIZE) {
269 page = call->reply3;
270 buffer = kmap_atomic(page, KM_USER0);
271 memset(buffer + PAGE_SIZE - call->count, 0,
272 call->count);
273 kunmap_atomic(buffer, KM_USER0);
274 }
275
276 /* extract the returned data */ 268 /* extract the returned data */
277 case 2: 269 case 2:
278 _debug("extract data"); 270 _debug("extract data");
279 page = call->reply3; 271 if (call->count > 0) {
280 buffer = kmap_atomic(page, KM_USER0); 272 page = call->reply3;
281 ret = afs_extract_data(call, skb, last, buffer, call->count); 273 buffer = kmap_atomic(page, KM_USER0);
282 kunmap_atomic(buffer, KM_USER0); 274 ret = afs_extract_data(call, skb, last, buffer,
283 switch (ret) { 275 call->count);
284 case 0: break; 276 kunmap_atomic(buffer, KM_USER0);
285 case -EAGAIN: return 0; 277 switch (ret) {
286 default: return ret; 278 case 0: break;
279 case -EAGAIN: return 0;
280 default: return ret;
281 }
287 } 282 }
288 283
289 call->offset = 0; 284 call->offset = 0;
@@ -318,6 +313,14 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call,
318 if (!last) 313 if (!last)
319 return 0; 314 return 0;
320 315
316 if (call->count < PAGE_SIZE) {
317 _debug("clear");
318 page = call->reply3;
319 buffer = kmap_atomic(page, KM_USER0);
320 memset(buffer + call->count, 0, PAGE_SIZE - call->count);
321 kunmap_atomic(buffer, KM_USER0);
322 }
323
321 _leave(" = 0 [done]"); 324 _leave(" = 0 [done]");
322 return 0; 325 return 0;
323} 326}
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index c184a4ee5995..9c984cc42cc9 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -125,7 +125,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
125 struct inode *inode; 125 struct inode *inode;
126 int ret; 126 int ret;
127 127
128 _enter(",{%u,%u,%u},,", fid->vid, fid->vnode, fid->unique); 128 _enter(",{%x:%u.%u},,", fid->vid, fid->vnode, fid->unique);
129 129
130 as = sb->s_fs_info; 130 as = sb->s_fs_info;
131 data.volume = as->volume; 131 data.volume = as->volume;
@@ -204,6 +204,19 @@ bad_inode:
204} 204}
205 205
206/* 206/*
207 * mark the data attached to an inode as obsolete due to a write on the server
208 * - might also want to ditch all the outstanding writes and dirty pages
209 */
210void afs_zap_data(struct afs_vnode *vnode)
211{
212 kenter("zap data {%x:%u}", vnode->fid.vid, vnode->fid.vnode);
213
214 /* nuke all the non-dirty pages that aren't locked, mapped or being
215 * written back */
216 invalidate_remote_inode(&vnode->vfs_inode);
217}
218
219/*
207 * validate a vnode/inode 220 * validate a vnode/inode
208 * - there are several things we need to check 221 * - there are several things we need to check
209 * - parent dir data changes (rm, rmdir, rename, mkdir, create, link, 222 * - parent dir data changes (rm, rmdir, rename, mkdir, create, link,
@@ -258,10 +271,8 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
258 271
259 /* if the vnode's data version number changed then its contents are 272 /* if the vnode's data version number changed then its contents are
260 * different */ 273 * different */
261 if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { 274 if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
262 _debug("zap data {%x:%d}", vnode->fid.vid, vnode->fid.vnode); 275 afs_zap_data(vnode);
263 invalidate_remote_inode(&vnode->vfs_inode);
264 }
265 276
266 clear_bit(AFS_VNODE_MODIFIED, &vnode->flags); 277 clear_bit(AFS_VNODE_MODIFIED, &vnode->flags);
267 mutex_unlock(&vnode->validate_lock); 278 mutex_unlock(&vnode->validate_lock);
@@ -278,7 +289,7 @@ error_unlock:
278/* 289/*
279 * read the attributes of an inode 290 * read the attributes of an inode
280 */ 291 */
281int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, 292int afs_getattr(struct vfsmount *mnt, struct dentry *dentry,
282 struct kstat *stat) 293 struct kstat *stat)
283{ 294{
284 struct inode *inode; 295 struct inode *inode;
@@ -301,7 +312,7 @@ void afs_clear_inode(struct inode *inode)
301 312
302 vnode = AFS_FS_I(inode); 313 vnode = AFS_FS_I(inode);
303 314
304 _enter("{%x:%d.%d} v=%u x=%u t=%u }", 315 _enter("{%x:%u.%d} v=%u x=%u t=%u }",
305 vnode->fid.vid, 316 vnode->fid.vid,
306 vnode->fid.vnode, 317 vnode->fid.vnode,
307 vnode->fid.unique, 318 vnode->fid.unique,
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index d90c158cd934..9feb5c59d8fc 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -433,10 +433,6 @@ extern const struct file_operations afs_file_operations;
433extern int afs_open(struct inode *, struct file *); 433extern int afs_open(struct inode *, struct file *);
434extern int afs_release(struct inode *, struct file *); 434extern int afs_release(struct inode *, struct file *);
435 435
436#ifdef AFS_CACHING_SUPPORT
437extern int afs_cache_get_page_cookie(struct page *, struct cachefs_page **);
438#endif
439
440/* 436/*
441 * fsclient.c 437 * fsclient.c
442 */ 438 */
@@ -474,10 +470,9 @@ extern int afs_fs_rename(struct afs_server *, struct key *,
474extern struct inode *afs_iget(struct super_block *, struct key *, 470extern struct inode *afs_iget(struct super_block *, struct key *,
475 struct afs_fid *, struct afs_file_status *, 471 struct afs_fid *, struct afs_file_status *,
476 struct afs_callback *); 472 struct afs_callback *);
473extern void afs_zap_data(struct afs_vnode *);
477extern int afs_validate(struct afs_vnode *, struct key *); 474extern int afs_validate(struct afs_vnode *, struct key *);
478extern int afs_inode_getattr(struct vfsmount *, struct dentry *, 475extern int afs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
479 struct kstat *);
480extern void afs_zap_permits(struct rcu_head *);
481extern void afs_clear_inode(struct inode *); 476extern void afs_clear_inode(struct inode *);
482 477
483/* 478/*
@@ -533,6 +528,7 @@ extern int afs_extract_data(struct afs_call *, struct sk_buff *, bool, void *,
533 */ 528 */
534extern void afs_clear_permits(struct afs_vnode *); 529extern void afs_clear_permits(struct afs_vnode *);
535extern void afs_cache_permit(struct afs_vnode *, struct key *, long); 530extern void afs_cache_permit(struct afs_vnode *, struct key *, long);
531extern void afs_zap_permits(struct rcu_head *);
536extern struct key *afs_request_key(struct afs_cell *); 532extern struct key *afs_request_key(struct afs_cell *);
537extern int afs_permission(struct inode *, int, struct nameidata *); 533extern int afs_permission(struct inode *, int, struct nameidata *);
538 534
@@ -726,6 +722,21 @@ do { \
726 } \ 722 } \
727} while(0) 723} while(0)
728 724
725#define ASSERTRANGE(L, OP1, N, OP2, H) \
726do { \
727 if (unlikely(!((L) OP1 (N)) || !((N) OP2 (H)))) { \
728 printk(KERN_ERR "\n"); \
729 printk(KERN_ERR "AFS: Assertion failed\n"); \
730 printk(KERN_ERR "%lu "#OP1" %lu "#OP2" %lu is false\n", \
731 (unsigned long)(L), (unsigned long)(N), \
732 (unsigned long)(H)); \
733 printk(KERN_ERR "0x%lx "#OP1" 0x%lx "#OP2" 0x%lx is false\n", \
734 (unsigned long)(L), (unsigned long)(N), \
735 (unsigned long)(H)); \
736 BUG(); \
737 } \
738} while(0)
739
729#define ASSERTIF(C, X) \ 740#define ASSERTIF(C, X) \
730do { \ 741do { \
731 if (unlikely((C) && !(X))) { \ 742 if (unlikely((C) && !(X))) { \
@@ -758,6 +769,10 @@ do { \
758do { \ 769do { \
759} while(0) 770} while(0)
760 771
772#define ASSERTRANGE(L, OP1, N, OP2, H) \
773do { \
774} while(0)
775
761#define ASSERTIF(C, X) \ 776#define ASSERTIF(C, X) \
762do { \ 777do { \
763} while(0) 778} while(0)
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 80ec6fd19a73..f1f71ff7d5c6 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -149,6 +149,7 @@ error_cache:
149 afs_vlocation_purge(); 149 afs_vlocation_purge();
150 afs_cell_purge(); 150 afs_cell_purge();
151 afs_proc_cleanup(); 151 afs_proc_cleanup();
152 rcu_barrier();
152 printk(KERN_ERR "kAFS: failed to register: %d\n", ret); 153 printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
153 return ret; 154 return ret;
154} 155}
@@ -176,6 +177,7 @@ static void __exit afs_exit(void)
176 cachefs_unregister_netfs(&afs_cache_netfs); 177 cachefs_unregister_netfs(&afs_cache_netfs);
177#endif 178#endif
178 afs_proc_cleanup(); 179 afs_proc_cleanup();
180 rcu_barrier();
179} 181}
180 182
181module_exit(afs_exit); 183module_exit(afs_exit);
diff --git a/fs/afs/misc.c b/fs/afs/misc.c
index cdb9792d8161..d1a889c40742 100644
--- a/fs/afs/misc.c
+++ b/fs/afs/misc.c
@@ -22,6 +22,7 @@ int afs_abort_to_error(u32 abort_code)
22{ 22{
23 switch (abort_code) { 23 switch (abort_code) {
24 case 13: return -EACCES; 24 case 13: return -EACCES;
25 case 27: return -EFBIG;
25 case 30: return -EROFS; 26 case 30: return -EROFS;
26 case VSALVAGE: return -EIO; 27 case VSALVAGE: return -EIO;
27 case VNOVNODE: return -ENOENT; 28 case VNOVNODE: return -ENOENT;
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 034fcfd4e330..a3684dcc76e7 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -36,7 +36,7 @@ const struct inode_operations afs_mntpt_inode_operations = {
36 .lookup = afs_mntpt_lookup, 36 .lookup = afs_mntpt_lookup,
37 .follow_link = afs_mntpt_follow_link, 37 .follow_link = afs_mntpt_follow_link,
38 .readlink = page_readlink, 38 .readlink = page_readlink,
39 .getattr = afs_inode_getattr, 39 .getattr = afs_getattr,
40}; 40};
41 41
42static LIST_HEAD(afs_vfsmounts); 42static LIST_HEAD(afs_vfsmounts);
@@ -58,7 +58,8 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
58 char *buf; 58 char *buf;
59 int ret; 59 int ret;
60 60
61 _enter("{%u,%u}", vnode->fid.vnode, vnode->fid.unique); 61 _enter("{%x:%u,%u}",
62 vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
62 63
63 /* read the contents of the symlink into the pagecache */ 64 /* read the contents of the symlink into the pagecache */
64 page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, &file); 65 page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, &file);
diff --git a/fs/afs/security.c b/fs/afs/security.c
index f9f424d80458..e0ea88b63ebf 100644
--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@ -109,7 +109,7 @@ void afs_clear_permits(struct afs_vnode *vnode)
109{ 109{
110 struct afs_permits *permits; 110 struct afs_permits *permits;
111 111
112 _enter("{%x}", vnode->fid.vnode); 112 _enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode);
113 113
114 mutex_lock(&vnode->permits_lock); 114 mutex_lock(&vnode->permits_lock);
115 permits = vnode->permits; 115 permits = vnode->permits;
@@ -132,7 +132,8 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key, long acl_order)
132 struct afs_vnode *auth_vnode; 132 struct afs_vnode *auth_vnode;
133 int count, loop; 133 int count, loop;
134 134
135 _enter("{%x},%x,%lx", vnode->fid.vnode, key_serial(key), acl_order); 135 _enter("{%x:%u},%x,%lx",
136 vnode->fid.vid, vnode->fid.vnode, key_serial(key), acl_order);
136 137
137 auth_vnode = afs_get_auth_inode(vnode, key); 138 auth_vnode = afs_get_auth_inode(vnode, key);
138 if (IS_ERR(auth_vnode)) { 139 if (IS_ERR(auth_vnode)) {
@@ -220,7 +221,8 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key,
220 bool valid; 221 bool valid;
221 int loop, ret; 222 int loop, ret;
222 223
223 _enter(""); 224 _enter("{%x:%u},%x",
225 vnode->fid.vid, vnode->fid.vnode, key_serial(key));
224 226
225 auth_vnode = afs_get_auth_inode(vnode, key); 227 auth_vnode = afs_get_auth_inode(vnode, key);
226 if (IS_ERR(auth_vnode)) { 228 if (IS_ERR(auth_vnode)) {
@@ -268,9 +270,9 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key,
268 _leave(" = %d", ret); 270 _leave(" = %d", ret);
269 return ret; 271 return ret;
270 } 272 }
273 *_access = vnode->status.caller_access;
271 } 274 }
272 275
273 *_access = vnode->status.caller_access;
274 iput(&auth_vnode->vfs_inode); 276 iput(&auth_vnode->vfs_inode);
275 _leave(" = 0 [access %x]", *_access); 277 _leave(" = 0 [access %x]", *_access);
276 return 0; 278 return 0;
@@ -288,7 +290,7 @@ int afs_permission(struct inode *inode, int mask, struct nameidata *nd)
288 struct key *key; 290 struct key *key;
289 int ret; 291 int ret;
290 292
291 _enter("{{%x:%x},%lx},%x,", 293 _enter("{{%x:%u},%lx},%x,",
292 vnode->fid.vid, vnode->fid.vnode, vnode->flags, mask); 294 vnode->fid.vid, vnode->fid.vnode, vnode->flags, mask);
293 295
294 key = afs_request_key(vnode->volume->cell); 296 key = afs_request_key(vnode->volume->cell);
diff --git a/fs/afs/server.c b/fs/afs/server.c
index 96bb23b476a2..231ae4150279 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -252,6 +252,9 @@ static void afs_destroy_server(struct afs_server *server)
252{ 252{
253 _enter("%p", server); 253 _enter("%p", server);
254 254
255 ASSERTIF(server->cb_break_head != server->cb_break_tail,
256 delayed_work_pending(&server->cb_break_work));
257
255 ASSERTCMP(server->fs_vnodes.rb_node, ==, NULL); 258 ASSERTCMP(server->fs_vnodes.rb_node, ==, NULL);
256 ASSERTCMP(server->cb_promises.rb_node, ==, NULL); 259 ASSERTCMP(server->cb_promises.rb_node, ==, NULL);
257 ASSERTCMP(server->cb_break_head, ==, server->cb_break_tail); 260 ASSERTCMP(server->cb_break_head, ==, server->cb_break_tail);
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c
index a1904ab8426a..0e37f9949cb7 100644
--- a/fs/afs/vnode.c
+++ b/fs/afs/vnode.c
@@ -261,7 +261,7 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode,
261 261
262 DECLARE_WAITQUEUE(myself, current); 262 DECLARE_WAITQUEUE(myself, current);
263 263
264 _enter("%s,{%u,%u,%u}", 264 _enter("%s,{%x:%u.%u}",
265 vnode->volume->vlocation->vldb.name, 265 vnode->volume->vlocation->vldb.name,
266 vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); 266 vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
267 267
@@ -389,7 +389,7 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode, struct key *key,
389 struct afs_server *server; 389 struct afs_server *server;
390 int ret; 390 int ret;
391 391
392 _enter("%s{%u,%u,%u},%x,,,", 392 _enter("%s{%x:%u.%u},%x,,,",
393 vnode->volume->vlocation->vldb.name, 393 vnode->volume->vlocation->vldb.name,
394 vnode->fid.vid, 394 vnode->fid.vid,
395 vnode->fid.vnode, 395 vnode->fid.vnode,
@@ -446,7 +446,7 @@ int afs_vnode_create(struct afs_vnode *vnode, struct key *key,
446 struct afs_server *server; 446 struct afs_server *server;
447 int ret; 447 int ret;
448 448
449 _enter("%s{%u,%u,%u},%x,%s,,", 449 _enter("%s{%x:%u.%u},%x,%s,,",
450 vnode->volume->vlocation->vldb.name, 450 vnode->volume->vlocation->vldb.name,
451 vnode->fid.vid, 451 vnode->fid.vid,
452 vnode->fid.vnode, 452 vnode->fid.vnode,
@@ -502,7 +502,7 @@ int afs_vnode_remove(struct afs_vnode *vnode, struct key *key, const char *name,
502 struct afs_server *server; 502 struct afs_server *server;
503 int ret; 503 int ret;
504 504
505 _enter("%s{%u,%u,%u},%x,%s", 505 _enter("%s{%x:%u.%u},%x,%s",
506 vnode->volume->vlocation->vldb.name, 506 vnode->volume->vlocation->vldb.name,
507 vnode->fid.vid, 507 vnode->fid.vid,
508 vnode->fid.vnode, 508 vnode->fid.vnode,
@@ -557,7 +557,7 @@ extern int afs_vnode_link(struct afs_vnode *dvnode, struct afs_vnode *vnode,
557 struct afs_server *server; 557 struct afs_server *server;
558 int ret; 558 int ret;
559 559
560 _enter("%s{%u,%u,%u},%s{%u,%u,%u},%x,%s", 560 _enter("%s{%x:%u.%u},%s{%x:%u.%u},%x,%s",
561 dvnode->volume->vlocation->vldb.name, 561 dvnode->volume->vlocation->vldb.name,
562 dvnode->fid.vid, 562 dvnode->fid.vid,
563 dvnode->fid.vnode, 563 dvnode->fid.vnode,
@@ -628,7 +628,7 @@ int afs_vnode_symlink(struct afs_vnode *vnode, struct key *key,
628 struct afs_server *server; 628 struct afs_server *server;
629 int ret; 629 int ret;
630 630
631 _enter("%s{%u,%u,%u},%x,%s,%s,,,", 631 _enter("%s{%x:%u.%u},%x,%s,%s,,,",
632 vnode->volume->vlocation->vldb.name, 632 vnode->volume->vlocation->vldb.name,
633 vnode->fid.vid, 633 vnode->fid.vid,
634 vnode->fid.vnode, 634 vnode->fid.vnode,
@@ -687,7 +687,7 @@ int afs_vnode_rename(struct afs_vnode *orig_dvnode,
687 struct afs_server *server; 687 struct afs_server *server;
688 int ret; 688 int ret;
689 689
690 _enter("%s{%u,%u,%u},%s{%u,%u,%u},%x,%s,%s", 690 _enter("%s{%x:%u.%u},%s{%u,%u,%u},%x,%s,%s",
691 orig_dvnode->volume->vlocation->vldb.name, 691 orig_dvnode->volume->vlocation->vldb.name,
692 orig_dvnode->fid.vid, 692 orig_dvnode->fid.vid,
693 orig_dvnode->fid.vnode, 693 orig_dvnode->fid.vnode,