summaryrefslogtreecommitdiff
path: root/fs/afs/file.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-08-28 09:00:20 +0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-08-28 09:00:20 +0400
commit4b61bb575b1fb42ab1df228ae7812e5135f656da (patch)
tree03456466e6f678456ea462a7da4b352d1aa03aa3 /fs/afs/file.c
parent805423e84e900e56c834aadee61a020b0d5092c3 (diff)
parent326ba5010a5429a5a528b268b36a5900d4ab0eba (diff)
downloadlinux-4b61bb575b1fb42ab1df228ae7812e5135f656da.tar.xz
Merge commit 'v2.6.31-rc8' into next
Diffstat (limited to 'fs/afs/file.c')
-rw-r--r--fs/afs/file.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 0149dab365e7..681c2a7b013f 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -134,9 +134,16 @@ static int afs_readpage(struct file *file, struct page *page)
inode = page->mapping->host;
- ASSERT(file != NULL);
- key = file->private_data;
- ASSERT(key != NULL);
+ if (file) {
+ key = file->private_data;
+ ASSERT(key != NULL);
+ } else {
+ key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell);
+ if (IS_ERR(key)) {
+ ret = PTR_ERR(key);
+ goto error_nokey;
+ }
+ }
_enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index);
@@ -207,12 +214,17 @@ static int afs_readpage(struct file *file, struct page *page)
unlock_page(page);
}
+ if (!file)
+ key_put(key);
_leave(" = 0");
return 0;
error:
SetPageError(page);
unlock_page(page);
+ if (!file)
+ key_put(key);
+error_nokey:
_leave(" = %d", ret);
return ret;
}