Commit 416351f2 authored by David Howells's avatar David Howells Committed by Linus Torvalds

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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ef71c15c
...@@ -44,7 +44,7 @@ void afs_init_callback_state(struct afs_server *server) ...@@ -44,7 +44,7 @@ void afs_init_callback_state(struct afs_server *server)
while (!RB_EMPTY_ROOT(&server->cb_promises)) { while (!RB_EMPTY_ROOT(&server->cb_promises)) {
vnode = rb_entry(server->cb_promises.rb_node, vnode = rb_entry(server->cb_promises.rb_node,
struct afs_vnode, cb_promise); struct afs_vnode, cb_promise);
_debug("UNPROMISE { vid=%x vn=%u uq=%u}", _debug("UNPROMISE { vid=%x:%u uq=%u}",
vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
rb_erase(&vnode->cb_promise, &server->cb_promises); rb_erase(&vnode->cb_promise, &server->cb_promises);
vnode->cb_promised = false; vnode->cb_promised = false;
...@@ -84,11 +84,8 @@ void afs_broken_callback_work(struct work_struct *work) ...@@ -84,11 +84,8 @@ void afs_broken_callback_work(struct work_struct *work)
/* if the vnode's data version number changed then its contents /* if the vnode's data version number changed then its contents
* are different */ * are different */
if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
_debug("zap data {%x:%u}", afs_zap_data(vnode);
vnode->fid.vid, vnode->fid.vnode);
invalidate_remote_inode(&vnode->vfs_inode);
}
} }
out: out:
......
...@@ -55,7 +55,7 @@ const struct inode_operations afs_dir_inode_operations = { ...@@ -55,7 +55,7 @@ const struct inode_operations afs_dir_inode_operations = {
.rmdir = afs_rmdir, .rmdir = afs_rmdir,
.rename = afs_rename, .rename = afs_rename,
.permission = afs_permission, .permission = afs_permission,
.getattr = afs_inode_getattr, .getattr = afs_getattr,
}; };
static struct dentry_operations afs_fs_dentry_operations = { static struct dentry_operations afs_fs_dentry_operations = {
...@@ -491,7 +491,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -491,7 +491,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
vnode = AFS_FS_I(dir); vnode = AFS_FS_I(dir);
_enter("{%x:%d},%p{%s},", _enter("{%x:%u},%p{%s},",
vnode->fid.vid, vnode->fid.vnode, dentry, dentry->d_name.name); vnode->fid.vid, vnode->fid.vnode, dentry, dentry->d_name.name);
ASSERTCMP(dentry->d_inode, ==, NULL); ASSERTCMP(dentry->d_inode, ==, NULL);
...@@ -731,7 +731,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -731,7 +731,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
dvnode = AFS_FS_I(dir); dvnode = AFS_FS_I(dir);
_enter("{%x:%d},{%s},%o", _enter("{%x:%u},{%s},%o",
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
ret = -ENAMETOOLONG; ret = -ENAMETOOLONG;
...@@ -796,7 +796,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -796,7 +796,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
dvnode = AFS_FS_I(dir); dvnode = AFS_FS_I(dir);
_enter("{%x:%d},{%s}", _enter("{%x:%u},{%s}",
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name); dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
ret = -ENAMETOOLONG; ret = -ENAMETOOLONG;
...@@ -842,7 +842,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -842,7 +842,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
dvnode = AFS_FS_I(dir); dvnode = AFS_FS_I(dir);
_enter("{%x:%d},{%s}", _enter("{%x:%u},{%s}",
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name); dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name);
ret = -ENAMETOOLONG; ret = -ENAMETOOLONG;
...@@ -916,7 +916,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -916,7 +916,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode,
dvnode = AFS_FS_I(dir); dvnode = AFS_FS_I(dir);
_enter("{%x:%d},{%s},%o,", _enter("{%x:%u},{%s},%o,",
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode);
ret = -ENAMETOOLONG; ret = -ENAMETOOLONG;
...@@ -983,7 +983,7 @@ static int afs_link(struct dentry *from, struct inode *dir, ...@@ -983,7 +983,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
vnode = AFS_FS_I(from->d_inode); vnode = AFS_FS_I(from->d_inode);
dvnode = AFS_FS_I(dir); dvnode = AFS_FS_I(dir);
_enter("{%x:%d},{%x:%d},{%s}", _enter("{%x:%u},{%x:%u},{%s}",
vnode->fid.vid, vnode->fid.vnode, vnode->fid.vid, vnode->fid.vnode,
dvnode->fid.vid, dvnode->fid.vnode, dvnode->fid.vid, dvnode->fid.vnode,
dentry->d_name.name); dentry->d_name.name);
...@@ -1032,7 +1032,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, ...@@ -1032,7 +1032,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
dvnode = AFS_FS_I(dir); dvnode = AFS_FS_I(dir);
_enter("{%x:%d},{%s},%s", _enter("{%x:%u},{%s},%s",
dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name,
content); content);
...@@ -1104,7 +1104,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1104,7 +1104,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
orig_dvnode = AFS_FS_I(old_dir); orig_dvnode = AFS_FS_I(old_dir);
new_dvnode = AFS_FS_I(new_dir); new_dvnode = AFS_FS_I(new_dir);
_enter("{%x:%d},{%x:%d},{%x:%d},{%s}", _enter("{%x:%u},{%x:%u},{%x:%u},{%s}",
orig_dvnode->fid.vid, orig_dvnode->fid.vnode, orig_dvnode->fid.vid, orig_dvnode->fid.vnode,
vnode->fid.vid, vnode->fid.vnode, vnode->fid.vid, vnode->fid.vnode,
new_dvnode->fid.vid, new_dvnode->fid.vnode, new_dvnode->fid.vid, new_dvnode->fid.vnode,
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include "internal.h" #include "internal.h"
static int afs_file_readpage(struct file *file, struct page *page); static int afs_readpage(struct file *file, struct page *page);
static void afs_file_invalidatepage(struct page *page, unsigned long offset); static void afs_invalidatepage(struct page *page, unsigned long offset);
static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); static int afs_releasepage(struct page *page, gfp_t gfp_flags);
const struct file_operations afs_file_operations = { const struct file_operations afs_file_operations = {
.open = afs_open, .open = afs_open,
...@@ -32,15 +32,15 @@ const struct file_operations afs_file_operations = { ...@@ -32,15 +32,15 @@ const struct file_operations afs_file_operations = {
}; };
const struct inode_operations afs_file_inode_operations = { const struct inode_operations afs_file_inode_operations = {
.getattr = afs_inode_getattr, .getattr = afs_getattr,
.permission = afs_permission, .permission = afs_permission,
}; };
const struct address_space_operations afs_fs_aops = { const struct address_space_operations afs_fs_aops = {
.readpage = afs_file_readpage, .readpage = afs_readpage,
.set_page_dirty = __set_page_dirty_nobuffers, .set_page_dirty = __set_page_dirty_nobuffers,
.releasepage = afs_file_releasepage, .releasepage = afs_releasepage,
.invalidatepage = afs_file_invalidatepage, .invalidatepage = afs_invalidatepage,
}; };
/* /*
...@@ -52,7 +52,7 @@ int afs_open(struct inode *inode, struct file *file) ...@@ -52,7 +52,7 @@ int afs_open(struct inode *inode, struct file *file)
struct key *key; struct key *key;
int ret; int ret;
_enter("{%x:%x},", vnode->fid.vid, vnode->fid.vnode); _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
key = afs_request_key(vnode->volume->cell); key = afs_request_key(vnode->volume->cell);
if (IS_ERR(key)) { if (IS_ERR(key)) {
...@@ -78,7 +78,7 @@ int afs_release(struct inode *inode, struct file *file) ...@@ -78,7 +78,7 @@ int afs_release(struct inode *inode, struct file *file)
{ {
struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_vnode *vnode = AFS_FS_I(inode);
_enter("{%x:%x},", vnode->fid.vid, vnode->fid.vnode); _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
key_put(file->private_data); key_put(file->private_data);
_leave(" = 0"); _leave(" = 0");
...@@ -89,7 +89,7 @@ int afs_release(struct inode *inode, struct file *file) ...@@ -89,7 +89,7 @@ int afs_release(struct inode *inode, struct file *file)
* deal with notification that a page was read from the cache * deal with notification that a page was read from the cache
*/ */
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
static void afs_file_readpage_read_complete(void *cookie_data, static void afs_readpage_read_complete(void *cookie_data,
struct page *page, struct page *page,
void *data, void *data,
int error) int error)
...@@ -109,7 +109,7 @@ static void afs_file_readpage_read_complete(void *cookie_data, ...@@ -109,7 +109,7 @@ static void afs_file_readpage_read_complete(void *cookie_data,
* deal with notification that a page was written to the cache * deal with notification that a page was written to the cache
*/ */
#ifdef AFS_CACHING_SUPPORT #ifdef AFS_CACHING_SUPPORT
static void afs_file_readpage_write_complete(void *cookie_data, static void afs_readpage_write_complete(void *cookie_data,
struct page *page, struct page *page,
void *data, void *data,
int error) int error)
...@@ -121,9 +121,9 @@ static void afs_file_readpage_write_complete(void *cookie_data, ...@@ -121,9 +121,9 @@ static void afs_file_readpage_write_complete(void *cookie_data,
#endif #endif
/* /*
* AFS read page from file (or symlink) * AFS read page from file, directory or symlink
*/ */
static int afs_file_readpage(struct file *file, struct page *page) static int afs_readpage(struct file *file, struct page *page)
{ {
struct afs_vnode *vnode; struct afs_vnode *vnode;
struct inode *inode; struct inode *inode;
...@@ -218,31 +218,14 @@ static int afs_file_readpage(struct file *file, struct page *page) ...@@ -218,31 +218,14 @@ static int afs_file_readpage(struct file *file, struct page *page)
return ret; return ret;
} }
/*
* get a page cookie for the specified page
*/
#ifdef AFS_CACHING_SUPPORT
int afs_cache_get_page_cookie(struct page *page,
struct cachefs_page **_page_cookie)
{
int ret;
_enter("");
ret = cachefs_page_get_private(page,_page_cookie, GFP_NOIO);
_leave(" = %d", ret);
return ret;
}
#endif
/* /*
* invalidate part or all of a page * invalidate part or all of a page
*/ */
static void afs_file_invalidatepage(struct page *page, unsigned long offset) static void afs_invalidatepage(struct page *page, unsigned long offset)
{ {
int ret = 1; int ret = 1;
_enter("{%lu},%lu", page->index, offset); kenter("{%lu},%lu", page->index, offset);
BUG_ON(!PageLocked(page)); BUG_ON(!PageLocked(page));
...@@ -274,23 +257,17 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset) ...@@ -274,23 +257,17 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset)
/* /*
* release a page and cleanup its private data * release a page and cleanup its private data
*/ */
static int afs_file_releasepage(struct page *page, gfp_t gfp_flags) static int afs_releasepage(struct page *page, gfp_t gfp_flags)
{ {
struct cachefs_page *pageio; struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
_enter("{%lu},%x", page->index, gfp_flags); _enter("{{%x:%u}[%lu],%lx},%x",
vnode->fid.vid, vnode->fid.vnode, page->index, page->flags,
gfp_flags);
if (PagePrivate(page)) { if (PagePrivate(page)) {
#ifdef AFS_CACHING_SUPPORT
struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
cachefs_uncache_page(vnode->cache, page);
#endif
pageio = (struct cachefs_page *) page_private(page);
set_page_private(page, 0); set_page_private(page, 0);
ClearPagePrivate(page); ClearPagePrivate(page);
kfree(pageio);
} }
_leave(" = 0"); _leave(" = 0");
......
...@@ -206,7 +206,7 @@ int afs_fs_fetch_file_status(struct afs_server *server, ...@@ -206,7 +206,7 @@ int afs_fs_fetch_file_status(struct afs_server *server,
struct afs_call *call; struct afs_call *call;
__be32 *bp; __be32 *bp;
_enter(",%x,{%x:%d},,", _enter(",%x,{%x:%u},,",
key_serial(key), vnode->fid.vid, vnode->fid.vnode); key_serial(key), vnode->fid.vid, vnode->fid.vnode);
call = afs_alloc_flat_call(&afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4); call = afs_alloc_flat_call(&afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4);
...@@ -265,26 +265,21 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call, ...@@ -265,26 +265,21 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call,
call->offset = 0; call->offset = 0;
call->unmarshall++; call->unmarshall++;
if (call->count < PAGE_SIZE) {
page = call->reply3;
buffer = kmap_atomic(page, KM_USER0);
memset(buffer + PAGE_SIZE - call->count, 0,
call->count);
kunmap_atomic(buffer, KM_USER0);
}
/* extract the returned data */ /* extract the returned data */
case 2: case 2:
_debug("extract data"); _debug("extract data");
if (call->count > 0) {
page = call->reply3; page = call->reply3;
buffer = kmap_atomic(page, KM_USER0); buffer = kmap_atomic(page, KM_USER0);
ret = afs_extract_data(call, skb, last, buffer, call->count); ret = afs_extract_data(call, skb, last, buffer,
call->count);
kunmap_atomic(buffer, KM_USER0); kunmap_atomic(buffer, KM_USER0);
switch (ret) { switch (ret) {
case 0: break; case 0: break;
case -EAGAIN: return 0; case -EAGAIN: return 0;
default: return ret; default: return ret;
} }
}
call->offset = 0; call->offset = 0;
call->unmarshall++; call->unmarshall++;
...@@ -318,6 +313,14 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call, ...@@ -318,6 +313,14 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call,
if (!last) if (!last)
return 0; return 0;
if (call->count < PAGE_SIZE) {
_debug("clear");
page = call->reply3;
buffer = kmap_atomic(page, KM_USER0);
memset(buffer + call->count, 0, PAGE_SIZE - call->count);
kunmap_atomic(buffer, KM_USER0);
}
_leave(" = 0 [done]"); _leave(" = 0 [done]");
return 0; return 0;
} }
......
...@@ -125,7 +125,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key, ...@@ -125,7 +125,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
struct inode *inode; struct inode *inode;
int ret; int ret;
_enter(",{%u,%u,%u},,", fid->vid, fid->vnode, fid->unique); _enter(",{%x:%u.%u},,", fid->vid, fid->vnode, fid->unique);
as = sb->s_fs_info; as = sb->s_fs_info;
data.volume = as->volume; data.volume = as->volume;
...@@ -203,6 +203,19 @@ struct inode *afs_iget(struct super_block *sb, struct key *key, ...@@ -203,6 +203,19 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
/*
* mark the data attached to an inode as obsolete due to a write on the server
* - might also want to ditch all the outstanding writes and dirty pages
*/
void afs_zap_data(struct afs_vnode *vnode)
{
kenter("zap data {%x:%u}", vnode->fid.vid, vnode->fid.vnode);
/* nuke all the non-dirty pages that aren't locked, mapped or being
* written back */
invalidate_remote_inode(&vnode->vfs_inode);
}
/* /*
* validate a vnode/inode * validate a vnode/inode
* - there are several things we need to check * - there are several things we need to check
...@@ -258,10 +271,8 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) ...@@ -258,10 +271,8 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
/* if the vnode's data version number changed then its contents are /* if the vnode's data version number changed then its contents are
* different */ * different */
if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
_debug("zap data {%x:%d}", vnode->fid.vid, vnode->fid.vnode); afs_zap_data(vnode);
invalidate_remote_inode(&vnode->vfs_inode);
}
clear_bit(AFS_VNODE_MODIFIED, &vnode->flags); clear_bit(AFS_VNODE_MODIFIED, &vnode->flags);
mutex_unlock(&vnode->validate_lock); mutex_unlock(&vnode->validate_lock);
...@@ -278,7 +289,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) ...@@ -278,7 +289,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
/* /*
* read the attributes of an inode * read the attributes of an inode
*/ */
int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, int afs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat) struct kstat *stat)
{ {
struct inode *inode; struct inode *inode;
...@@ -301,7 +312,7 @@ void afs_clear_inode(struct inode *inode) ...@@ -301,7 +312,7 @@ void afs_clear_inode(struct inode *inode)
vnode = AFS_FS_I(inode); vnode = AFS_FS_I(inode);
_enter("{%x:%d.%d} v=%u x=%u t=%u }", _enter("{%x:%u.%d} v=%u x=%u t=%u }",
vnode->fid.vid, vnode->fid.vid,
vnode->fid.vnode, vnode->fid.vnode,
vnode->fid.unique, vnode->fid.unique,
......
...@@ -433,10 +433,6 @@ extern const struct file_operations afs_file_operations; ...@@ -433,10 +433,6 @@ extern const struct file_operations afs_file_operations;
extern int afs_open(struct inode *, struct file *); extern int afs_open(struct inode *, struct file *);
extern int afs_release(struct inode *, struct file *); extern int afs_release(struct inode *, struct file *);
#ifdef AFS_CACHING_SUPPORT
extern int afs_cache_get_page_cookie(struct page *, struct cachefs_page **);
#endif
/* /*
* fsclient.c * fsclient.c
*/ */
...@@ -474,10 +470,9 @@ extern int afs_fs_rename(struct afs_server *, struct key *, ...@@ -474,10 +470,9 @@ extern int afs_fs_rename(struct afs_server *, struct key *,
extern struct inode *afs_iget(struct super_block *, struct key *, extern struct inode *afs_iget(struct super_block *, struct key *,
struct afs_fid *, struct afs_file_status *, struct afs_fid *, struct afs_file_status *,
struct afs_callback *); struct afs_callback *);
extern void afs_zap_data(struct afs_vnode *);
extern int afs_validate(struct afs_vnode *, struct key *); extern int afs_validate(struct afs_vnode *, struct key *);
extern int afs_inode_getattr(struct vfsmount *, struct dentry *, extern int afs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
struct kstat *);
extern void afs_zap_permits(struct rcu_head *);
extern void afs_clear_inode(struct inode *); extern void afs_clear_inode(struct inode *);
/* /*
...@@ -533,6 +528,7 @@ extern int afs_extract_data(struct afs_call *, struct sk_buff *, bool, void *, ...@@ -533,6 +528,7 @@ extern int afs_extract_data(struct afs_call *, struct sk_buff *, bool, void *,
*/ */
extern void afs_clear_permits(struct afs_vnode *); extern void afs_clear_permits(struct afs_vnode *);
extern void afs_cache_permit(struct afs_vnode *, struct key *, long); extern void afs_cache_permit(struct afs_vnode *, struct key *, long);
extern void afs_zap_permits(struct rcu_head *);
extern struct key *afs_request_key(struct afs_cell *); extern struct key *afs_request_key(struct afs_cell *);
extern int afs_permission(struct inode *, int, struct nameidata *); extern int afs_permission(struct inode *, int, struct nameidata *);
...@@ -726,6 +722,21 @@ do { \ ...@@ -726,6 +722,21 @@ do { \
} \ } \
} while(0) } while(0)
#define ASSERTRANGE(L, OP1, N, OP2, H) \
do { \
if (unlikely(!((L) OP1 (N)) || !((N) OP2 (H)))) { \
printk(KERN_ERR "\n"); \
printk(KERN_ERR "AFS: Assertion failed\n"); \
printk(KERN_ERR "%lu "#OP1" %lu "#OP2" %lu is false\n", \
(unsigned long)(L), (unsigned long)(N), \
(unsigned long)(H)); \
printk(KERN_ERR "0x%lx "#OP1" 0x%lx "#OP2" 0x%lx is false\n", \
(unsigned long)(L), (unsigned long)(N), \
(unsigned long)(H)); \
BUG(); \
} \
} while(0)
#define ASSERTIF(C, X) \ #define ASSERTIF(C, X) \
do { \ do { \
if (unlikely((C) && !(X))) { \ if (unlikely((C) && !(X))) { \
...@@ -758,6 +769,10 @@ do { \ ...@@ -758,6 +769,10 @@ do { \
do { \ do { \
} while(0) } while(0)
#define ASSERTRANGE(L, OP1, N, OP2, H) \
do { \
} while(0)
#define ASSERTIF(C, X) \ #define ASSERTIF(C, X) \
do { \ do { \
} while(0) } while(0)
......
...@@ -149,6 +149,7 @@ static int __init afs_init(void) ...@@ -149,6 +149,7 @@ static int __init afs_init(void)
afs_vlocation_purge(); afs_vlocation_purge();
afs_cell_purge(); afs_cell_purge();
afs_proc_cleanup(); afs_proc_cleanup();
rcu_barrier();
printk(KERN_ERR "kAFS: failed to register: %d\n", ret); printk(KERN_ERR "kAFS: failed to register: %d\n", ret);
return ret; return ret;
} }
...@@ -176,6 +177,7 @@ static void __exit afs_exit(void) ...@@ -176,6 +177,7 @@ static void __exit afs_exit(void)
cachefs_unregister_netfs(&afs_cache_netfs); cachefs_unregister_netfs(&afs_cache_netfs);
#endif #endif
afs_proc_cleanup(); afs_proc_cleanup();
rcu_barrier();
} }
module_exit(afs_exit); module_exit(afs_exit);
...@@ -22,6 +22,7 @@ int afs_abort_to_error(u32 abort_code) ...@@ -22,6 +22,7 @@ int afs_abort_to_error(u32 abort_code)
{ {
switch (abort_code) { switch (abort_code) {
case 13: return -EACCES; case 13: return -EACCES;
case 27: return -EFBIG;
case 30: return -EROFS; case 30: return -EROFS;
case VSALVAGE: return -EIO; case VSALVAGE: return -EIO;
case VNOVNODE: return -ENOENT; case VNOVNODE: return -ENOENT;
......
...@@ -36,7 +36,7 @@ const struct inode_operations afs_mntpt_inode_operations = { ...@@ -36,7 +36,7 @@ const struct inode_operations afs_mntpt_inode_operations = {
.lookup = afs_mntpt_lookup, .lookup = afs_mntpt_lookup,
.follow_link = afs_mntpt_follow_link, .follow_link = afs_mntpt_follow_link,
.readlink = page_readlink, .readlink = page_readlink,
.getattr = afs_inode_getattr, .getattr = afs_getattr,
}; };
static LIST_HEAD(afs_vfsmounts); static LIST_HEAD(afs_vfsmounts);
...@@ -58,7 +58,8 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key) ...@@ -58,7 +58,8 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
char *buf; char *buf;
int ret; int ret;
_enter("{%u,%u}", vnode->fid.vnode, vnode->fid.unique); _enter("{%x:%u,%u}",
vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
/* read the contents of the symlink into the pagecache */ /* read the contents of the symlink into the pagecache */
page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, &file); page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, &file);
......
...@@ -109,7 +109,7 @@ void afs_clear_permits(struct afs_vnode *vnode) ...@@ -109,7 +109,7 @@ void afs_clear_permits(struct afs_vnode *vnode)
{ {
struct afs_permits *permits; struct afs_permits *permits;
_enter("{%x}", vnode->fid.vnode); _enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode);
mutex_lock(&vnode->permits_lock); mutex_lock(&vnode->permits_lock);
permits = vnode->permits; permits = vnode->permits;
...@@ -132,7 +132,8 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key, long acl_order) ...@@ -132,7 +132,8 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key, long acl_order)
struct afs_vnode *auth_vnode; struct afs_vnode *auth_vnode;
int count, loop; int count, loop;
_enter("{%x},%x,%lx", vnode->fid.vnode, key_serial(key), acl_order); _enter("{%x:%u},%x,%lx",
vnode->fid.vid, vnode->fid.vnode, key_serial(key), acl_order);
auth_vnode = afs_get_auth_inode(vnode, key); auth_vnode = afs_get_auth_inode(vnode, key);
if (IS_ERR(auth_vnode)) { if (IS_ERR(auth_vnode)) {
...@@ -220,7 +221,8 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key, ...@@ -220,7 +221,8 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key,
bool valid; bool valid;
int loop, ret; int loop, ret;
_enter(""); _enter("{%x:%u},%x",
vnode->fid.vid, vnode->fid.vnode, key_serial(key));
auth_vnode = afs_get_auth_inode(vnode, key); auth_vnode = afs_get_auth_inode(vnode, key);
if (IS_ERR(auth_vnode)) { if (IS_ERR(auth_vnode)) {
...@@ -268,9 +270,9 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key, ...@@ -268,9 +270,9 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key,
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
} }
*_access = vnode->status.caller_access;
} }
*_access = vnode->status.caller_access;
iput(&auth_vnode->vfs_inode); iput(&auth_vnode->vfs_inode);
_leave(" = 0 [access %x]", *_access); _leave(" = 0 [access %x]", *_access);
return 0; return 0;
...@@ -288,7 +290,7 @@ int afs_permission(struct inode *inode, int mask, struct nameidata *nd) ...@@ -288,7 +290,7 @@ int afs_permission(struct inode *inode, int mask, struct nameidata *nd)
struct key *key; struct key *key;
int ret; int ret;
_enter("{{%x:%x},%lx},%x,", _enter("{{%x:%u},%lx},%x,",
vnode->fid.vid, vnode->fid.vnode, vnode->flags, mask); vnode->fid.vid, vnode->fid.vnode, vnode->flags, mask);
key = afs_request_key(vnode->volume->cell); key = afs_request_key(vnode->volume->cell);
......
...@@ -252,6 +252,9 @@ static void afs_destroy_server(struct afs_server *server) ...@@ -252,6 +252,9 @@ static void afs_destroy_server(struct afs_server *server)
{ {
_enter("%p", server); _enter("%p", server);
ASSERTIF(server->cb_break_head != server->cb_break_tail,
delayed_work_pending(&server->cb_break_work));
ASSERTCMP(server->fs_vnodes.rb_node, ==, NULL); ASSERTCMP(server->fs_vnodes.rb_node, ==, NULL);
ASSERTCMP(server->cb_promises.rb_node, ==, NULL); ASSERTCMP(server->cb_promises.rb_node, ==, NULL);
ASSERTCMP(server->cb_break_head, ==, server->cb_break_tail); ASSERTCMP(server->cb_break_head, ==, server->cb_break_tail);
......
...@@ -261,7 +261,7 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode, ...@@ -261,7 +261,7 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode,
DECLARE_WAITQUEUE(myself, current); DECLARE_WAITQUEUE(myself, current);
_enter("%s,{%u,%u,%u}", _enter("%s,{%x:%u.%u}",
vnode->volume->vlocation->vldb.name, vnode->volume->vlocation->vldb.name,
vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
...@@ -389,7 +389,7 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode, struct key *key, ...@@ -389,7 +389,7 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode, struct key *key,
struct afs_server *server; struct afs_server *server;
int ret; int ret;
_enter("%s{%u,%u,%u},%x,,,", _enter("%s{%x:%u.%u},%x,,,",
vnode->volume->vlocation->vldb.name, vnode->volume->vlocation->vldb.name,
vnode->fid.vid, vnode->fid.vid,
vnode->fid.vnode, vnode->fid.vnode,
...@@ -446,7 +446,7 @@ int afs_vnode_create(struct afs_vnode *vnode, struct key *key, ...@@ -446,7 +446,7 @@ int afs_vnode_create(struct afs_vnode *vnode, struct key *key,
struct afs_server *server; struct afs_server *server;
int ret; int ret;
_enter("%s{%u,%u,%u},%x,%s,,", _enter("%s{%x:%u.%u},%x,%s,,",
vnode->volume->vlocation->vldb.name, vnode->volume->vlocation->vldb.name,
vnode->fid.vid, vnode->fid.vid,
vnode->fid.vnode, vnode->fid.vnode,
...@@ -502,7 +502,7 @@ int afs_vnode_remove(struct afs_vnode *vnode, struct key *key, const char *name, ...@@ -502,7 +502,7 @@ int afs_vnode_remove(struct afs_vnode *vnode, struct key *key, const char *name,
struct afs_server *server; struct afs_server *server;
int ret; int ret;
_enter("%s{%u,%u,%u},%x,%s", _enter("%s{%x:%u.%u},%x,%s",
vnode->volume->vlocation->vldb.name, vnode->volume->vlocation->vldb.name,
vnode->fid.vid, vnode->fid.vid,
vnode->fid.vnode, vnode->fid.vnode,
...@@ -557,7 +557,7 @@ extern int afs_vnode_link(struct afs_vnode *dvnode, struct afs_vnode *vnode, ...@@ -557,7 +557,7 @@ extern int afs_vnode_link(struct afs_vnode *dvnode, struct afs_vnode *vnode,
struct afs_server *server; struct afs_server *server;
int ret; int ret;
_enter("%s{%u,%u,%u},%s{%u,%u,%u},%x,%s", _enter("%s{%x:%u.%u},%s{%x:%u.%u},%x,%s",
dvnode->volume->vlocation->vldb.name, dvnode->volume->vlocation->vldb.name,
dvnode->fid.vid, dvnode->fid.vid,
dvnode->fid.vnode, dvnode->fid.vnode,
...@@ -628,7 +628,7 @@ int afs_vnode_symlink(struct afs_vnode *vnode, struct key *key, ...@@ -628,7 +628,7 @@ int afs_vnode_symlink(struct afs_vnode *vnode, struct key *key,
struct afs_server *server; struct afs_server *server;
int ret; int ret;
_enter("%s{%u,%u,%u},%x,%s,%s,,,", _enter("%s{%x:%u.%u},%x,%s,%s,,,",
vnode->volume->vlocation->vldb.name, vnode->volume->vlocation->vldb.name,
vnode->fid.vid, vnode->fid.vid,
vnode->fid.vnode, vnode->fid.vnode,
...@@ -687,7 +687,7 @@ int afs_vnode_rename(struct afs_vnode *orig_dvnode, ...@@ -687,7 +687,7 @@ int afs_vnode_rename(struct afs_vnode *orig_dvnode,
struct afs_server *server; struct afs_server *server;
int ret; int ret;
_enter("%s{%u,%u,%u},%s{%u,%u,%u},%x,%s,%s", _enter("%s{%x:%u.%u},%s{%u,%u,%u},%x,%s,%s",
orig_dvnode->volume->vlocation->vldb.name, orig_dvnode->volume->vlocation->vldb.name,
orig_dvnode->fid.vid, orig_dvnode->fid.vid,
orig_dvnode->fid.vnode, orig_dvnode->fid.vnode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment