blob: 82897a78abc7f9186c637d1ddf7fd36ccacf3187 [file] [log] [blame]
David Howells08e0e7c2007-04-26 15:55:03 -07001/* AFS filesystem file handling
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
David Howells08e0e7c2007-04-26 15:55:03 -07003 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Written by David Howells ([email protected])
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/fs.h>
16#include <linux/pagemap.h>
David Howells31143d52007-05-09 02:33:46 -070017#include <linux/writeback.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090018#include <linux/gfp.h>
David Howells91b467e02017-01-05 10:38:35 +000019#include <linux/task_io_accounting_ops.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include "internal.h"
21
David Howells416351f2007-05-09 02:33:45 -070022static int afs_readpage(struct file *file, struct page *page);
Lukas Czernerd47992f2013-05-21 23:17:23 -040023static void afs_invalidatepage(struct page *page, unsigned int offset,
24 unsigned int length);
David Howells416351f2007-05-09 02:33:45 -070025static int afs_releasepage(struct page *page, gfp_t gfp_flags);
David Howells31143d52007-05-09 02:33:46 -070026static int afs_launder_page(struct page *page);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
David Howells9b3f26c2009-04-03 16:42:41 +010028static int afs_readpages(struct file *filp, struct address_space *mapping,
29 struct list_head *pages, unsigned nr_pages);
30
David Howells00d3b7a2007-04-26 15:57:07 -070031const struct file_operations afs_file_operations = {
32 .open = afs_open,
33 .release = afs_release,
34 .llseek = generic_file_llseek,
Al Viroaad4f8b2014-04-02 14:33:16 -040035 .read_iter = generic_file_read_iter,
Al Viro50b55512014-04-03 14:13:46 -040036 .write_iter = afs_file_write,
David Howells00d3b7a2007-04-26 15:57:07 -070037 .mmap = generic_file_readonly_mmap,
Jens Axboe5ffc4ef2007-06-01 11:49:19 +020038 .splice_read = generic_file_splice_read,
David Howells31143d52007-05-09 02:33:46 -070039 .fsync = afs_fsync,
David Howellse8d6c552007-07-15 23:40:12 -070040 .lock = afs_lock,
41 .flock = afs_flock,
David Howells00d3b7a2007-04-26 15:57:07 -070042};
43
Arjan van de Ven754661f2007-02-12 00:55:38 -080044const struct inode_operations afs_file_inode_operations = {
David Howells416351f2007-05-09 02:33:45 -070045 .getattr = afs_getattr,
David Howells31143d52007-05-09 02:33:46 -070046 .setattr = afs_setattr,
David Howells00d3b7a2007-04-26 15:57:07 -070047 .permission = afs_permission,
Linus Torvalds1da177e2005-04-16 15:20:36 -070048};
49
Christoph Hellwigf5e54d62006-06-28 04:26:44 -070050const struct address_space_operations afs_fs_aops = {
David Howells416351f2007-05-09 02:33:45 -070051 .readpage = afs_readpage,
David Howells9b3f26c2009-04-03 16:42:41 +010052 .readpages = afs_readpages,
David Howells31143d52007-05-09 02:33:46 -070053 .set_page_dirty = afs_set_page_dirty,
54 .launder_page = afs_launder_page,
David Howells416351f2007-05-09 02:33:45 -070055 .releasepage = afs_releasepage,
56 .invalidatepage = afs_invalidatepage,
Nick Piggin15b46502008-10-15 22:04:32 -070057 .write_begin = afs_write_begin,
58 .write_end = afs_write_end,
David Howells31143d52007-05-09 02:33:46 -070059 .writepage = afs_writepage,
60 .writepages = afs_writepages,
Linus Torvalds1da177e2005-04-16 15:20:36 -070061};
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063/*
David Howells00d3b7a2007-04-26 15:57:07 -070064 * open an AFS file or directory and attach a key to it
65 */
66int afs_open(struct inode *inode, struct file *file)
67{
68 struct afs_vnode *vnode = AFS_FS_I(inode);
69 struct key *key;
David Howells260a9802007-04-26 15:59:35 -070070 int ret;
David Howells00d3b7a2007-04-26 15:57:07 -070071
David Howells416351f2007-05-09 02:33:45 -070072 _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
David Howells00d3b7a2007-04-26 15:57:07 -070073
74 key = afs_request_key(vnode->volume->cell);
75 if (IS_ERR(key)) {
76 _leave(" = %ld [key]", PTR_ERR(key));
77 return PTR_ERR(key);
78 }
79
David Howells260a9802007-04-26 15:59:35 -070080 ret = afs_validate(vnode, key);
81 if (ret < 0) {
82 _leave(" = %d [val]", ret);
83 return ret;
84 }
85
David Howells00d3b7a2007-04-26 15:57:07 -070086 file->private_data = key;
87 _leave(" = 0");
88 return 0;
89}
90
91/*
92 * release an AFS file or directory and discard its key
93 */
94int afs_release(struct inode *inode, struct file *file)
95{
96 struct afs_vnode *vnode = AFS_FS_I(inode);
97
David Howells416351f2007-05-09 02:33:45 -070098 _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
David Howells00d3b7a2007-04-26 15:57:07 -070099
100 key_put(file->private_data);
101 _leave(" = 0");
102 return 0;
103}
104
David Howells196ee9c2017-01-05 10:38:34 +0000105/*
106 * Dispose of a ref to a read record.
107 */
108void afs_put_read(struct afs_read *req)
109{
110 int i;
111
112 if (atomic_dec_and_test(&req->usage)) {
113 for (i = 0; i < req->nr_pages; i++)
114 if (req->pages[i])
115 put_page(req->pages[i]);
116 kfree(req);
117 }
118}
119
Matt Kraai6566abd2009-04-17 12:56:38 +0100120#ifdef CONFIG_AFS_FSCACHE
David Howells00d3b7a2007-04-26 15:57:07 -0700121/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 * deal with notification that a page was read from the cache
123 */
David Howells9b3f26c2009-04-03 16:42:41 +0100124static void afs_file_readpage_read_complete(struct page *page,
125 void *data,
126 int error)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127{
David Howells9b3f26c2009-04-03 16:42:41 +0100128 _enter("%p,%p,%d", page, data, error);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
David Howells9b3f26c2009-04-03 16:42:41 +0100130 /* if the read completes with an error, we just unlock the page and let
131 * the VM reissue the readpage */
132 if (!error)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 SetPageUptodate(page);
134 unlock_page(page);
David Howellsec268152007-04-26 15:49:28 -0700135}
Matt Kraai6566abd2009-04-17 12:56:38 +0100136#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/*
Al Virof6d335c2010-05-21 15:27:09 +0100139 * read page from file, directory or symlink, given a key to use
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 */
Al Virof6d335c2010-05-21 15:27:09 +0100141int afs_page_filler(void *data, struct page *page)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142{
Al Virof6d335c2010-05-21 15:27:09 +0100143 struct inode *inode = page->mapping->host;
144 struct afs_vnode *vnode = AFS_FS_I(inode);
David Howells196ee9c2017-01-05 10:38:34 +0000145 struct afs_read *req;
Al Virof6d335c2010-05-21 15:27:09 +0100146 struct key *key = data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 int ret;
148
David Howells00d3b7a2007-04-26 15:57:07 -0700149 _enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
Matt Mackallcd7619d2005-05-01 08:59:01 -0700151 BUG_ON(!PageLocked(page));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152
153 ret = -ESTALE;
David Howells08e0e7c2007-04-26 15:55:03 -0700154 if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 goto error;
156
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 /* is it cached? */
David Howells9b3f26c2009-04-03 16:42:41 +0100158#ifdef CONFIG_AFS_FSCACHE
159 ret = fscache_read_or_alloc_page(vnode->cache,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 page,
161 afs_file_readpage_read_complete,
162 NULL,
163 GFP_KERNEL);
164#else
165 ret = -ENOBUFS;
166#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 switch (ret) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 /* read BIO submitted (page in cache) */
169 case 0:
170 break;
171
David Howells9b3f26c2009-04-03 16:42:41 +0100172 /* page not yet cached */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 case -ENODATA:
David Howells9b3f26c2009-04-03 16:42:41 +0100174 _debug("cache said ENODATA");
175 goto go_on;
176
177 /* page will not be cached */
178 case -ENOBUFS:
179 _debug("cache said ENOBUFS");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180 default:
David Howells9b3f26c2009-04-03 16:42:41 +0100181 go_on:
David Howells196ee9c2017-01-05 10:38:34 +0000182 req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *),
183 GFP_KERNEL);
184 if (!req)
185 goto enomem;
186
187 atomic_set(&req->usage, 1);
188 req->pos = (loff_t)page->index << PAGE_SHIFT;
189 req->len = min_t(size_t, i_size_read(inode) - req->pos,
190 PAGE_SIZE);
191 req->nr_pages = 1;
192 req->pages[0] = page;
193 get_page(page);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
195 /* read the contents of the file from the server into the
196 * page */
David Howells196ee9c2017-01-05 10:38:34 +0000197 ret = afs_vnode_fetch_data(vnode, key, req);
198 afs_put_read(req);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 if (ret < 0) {
David Howells08e0e7c2007-04-26 15:55:03 -0700200 if (ret == -ENOENT) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 _debug("got NOENT from server"
202 " - marking file deleted and stale");
David Howells08e0e7c2007-04-26 15:55:03 -0700203 set_bit(AFS_VNODE_DELETED, &vnode->flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 ret = -ESTALE;
205 }
David Howells9b3f26c2009-04-03 16:42:41 +0100206
207#ifdef CONFIG_AFS_FSCACHE
208 fscache_uncache_page(vnode->cache, page);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209#endif
David Howells9b3f26c2009-04-03 16:42:41 +0100210 BUG_ON(PageFsCache(page));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 goto error;
212 }
213
214 SetPageUptodate(page);
215
David Howells9b3f26c2009-04-03 16:42:41 +0100216 /* send the page to the cache */
217#ifdef CONFIG_AFS_FSCACHE
218 if (PageFsCache(page) &&
219 fscache_write_page(vnode->cache, page, GFP_KERNEL) != 0) {
220 fscache_uncache_page(vnode->cache, page);
221 BUG_ON(PageFsCache(page));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223#endif
David Howells9b3f26c2009-04-03 16:42:41 +0100224 unlock_page(page);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 }
226
227 _leave(" = 0");
228 return 0;
229
David Howells196ee9c2017-01-05 10:38:34 +0000230enomem:
231 ret = -ENOMEM;
David Howells08e0e7c2007-04-26 15:55:03 -0700232error:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 SetPageError(page);
234 unlock_page(page);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 _leave(" = %d", ret);
236 return ret;
David Howellsec268152007-04-26 15:49:28 -0700237}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239/*
Al Virof6d335c2010-05-21 15:27:09 +0100240 * read page from file, directory or symlink, given a file to nominate the key
241 * to be used
242 */
243static int afs_readpage(struct file *file, struct page *page)
244{
245 struct key *key;
246 int ret;
247
248 if (file) {
249 key = file->private_data;
250 ASSERT(key != NULL);
251 ret = afs_page_filler(key, page);
252 } else {
253 struct inode *inode = page->mapping->host;
254 key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell);
255 if (IS_ERR(key)) {
256 ret = PTR_ERR(key);
257 } else {
258 ret = afs_page_filler(key, page);
259 key_put(key);
260 }
261 }
262 return ret;
263}
264
265/*
David Howells91b467e02017-01-05 10:38:35 +0000266 * Make pages available as they're filled.
267 */
268static void afs_readpages_page_done(struct afs_call *call, struct afs_read *req)
269{
270 struct afs_vnode *vnode = call->reply;
271 struct page *page = req->pages[req->index];
272
273 req->pages[req->index] = NULL;
274 SetPageUptodate(page);
275
276 /* send the page to the cache */
277#ifdef CONFIG_AFS_FSCACHE
278 if (PageFsCache(page) &&
279 fscache_write_page(vnode->cache, page, GFP_KERNEL) != 0) {
280 fscache_uncache_page(vnode->cache, page);
281 BUG_ON(PageFsCache(page));
282 }
283#endif
284 unlock_page(page);
285 put_page(page);
286}
287
288/*
289 * Read a contiguous set of pages.
290 */
291static int afs_readpages_one(struct file *file, struct address_space *mapping,
292 struct list_head *pages)
293{
294 struct afs_vnode *vnode = AFS_FS_I(mapping->host);
295 struct afs_read *req;
296 struct list_head *p;
297 struct page *first, *page;
298 struct key *key = file->private_data;
299 pgoff_t index;
300 int ret, n, i;
301
302 /* Count the number of contiguous pages at the front of the list. Note
303 * that the list goes prev-wards rather than next-wards.
304 */
305 first = list_entry(pages->prev, struct page, lru);
306 index = first->index + 1;
307 n = 1;
308 for (p = first->lru.prev; p != pages; p = p->prev) {
309 page = list_entry(p, struct page, lru);
310 if (page->index != index)
311 break;
312 index++;
313 n++;
314 }
315
316 req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *) * n,
317 GFP_NOFS);
318 if (!req)
319 return -ENOMEM;
320
321 atomic_set(&req->usage, 1);
322 req->page_done = afs_readpages_page_done;
323 req->pos = first->index;
324 req->pos <<= PAGE_SHIFT;
325
326 /* Transfer the pages to the request. We add them in until one fails
327 * to add to the LRU and then we stop (as that'll make a hole in the
328 * contiguous run.
329 *
330 * Note that it's possible for the file size to change whilst we're
331 * doing this, but we rely on the server returning less than we asked
332 * for if the file shrank. We also rely on this to deal with a partial
333 * page at the end of the file.
334 */
335 do {
336 page = list_entry(pages->prev, struct page, lru);
337 list_del(&page->lru);
338 index = page->index;
339 if (add_to_page_cache_lru(page, mapping, index,
340 readahead_gfp_mask(mapping))) {
341#ifdef CONFIG_AFS_FSCACHE
342 fscache_uncache_page(vnode->cache, page);
343#endif
344 put_page(page);
345 break;
346 }
347
348 req->pages[req->nr_pages++] = page;
349 req->len += PAGE_SIZE;
350 } while (req->nr_pages < n);
351
352 if (req->nr_pages == 0) {
353 kfree(req);
354 return 0;
355 }
356
357 ret = afs_vnode_fetch_data(vnode, key, req);
358 if (ret < 0)
359 goto error;
360
361 task_io_account_read(PAGE_SIZE * req->nr_pages);
362 afs_put_read(req);
363 return 0;
364
365error:
366 if (ret == -ENOENT) {
367 _debug("got NOENT from server"
368 " - marking file deleted and stale");
369 set_bit(AFS_VNODE_DELETED, &vnode->flags);
370 ret = -ESTALE;
371 }
372
373 for (i = 0; i < req->nr_pages; i++) {
374 page = req->pages[i];
375 if (page) {
376#ifdef CONFIG_AFS_FSCACHE
377 fscache_uncache_page(vnode->cache, page);
378#endif
379 SetPageError(page);
380 unlock_page(page);
381 }
382 }
383
384 afs_put_read(req);
385 return ret;
386}
387
388/*
David Howells9b3f26c2009-04-03 16:42:41 +0100389 * read a set of pages
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 */
David Howells9b3f26c2009-04-03 16:42:41 +0100391static int afs_readpages(struct file *file, struct address_space *mapping,
392 struct list_head *pages, unsigned nr_pages)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393{
Al Virof6d335c2010-05-21 15:27:09 +0100394 struct key *key = file->private_data;
David Howells9b3f26c2009-04-03 16:42:41 +0100395 struct afs_vnode *vnode;
396 int ret = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397
Al Virof6d335c2010-05-21 15:27:09 +0100398 _enter("{%d},{%lu},,%d",
399 key_serial(key), mapping->host->i_ino, nr_pages);
400
401 ASSERT(key != NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402
David Howells9b3f26c2009-04-03 16:42:41 +0100403 vnode = AFS_FS_I(mapping->host);
Dan Carpenterad2a8e62012-03-20 16:58:06 +0000404 if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
David Howells9b3f26c2009-04-03 16:42:41 +0100405 _leave(" = -ESTALE");
406 return -ESTALE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 }
408
David Howells9b3f26c2009-04-03 16:42:41 +0100409 /* attempt to read as many of the pages as possible */
410#ifdef CONFIG_AFS_FSCACHE
411 ret = fscache_read_or_alloc_pages(vnode->cache,
412 mapping,
413 pages,
414 &nr_pages,
415 afs_file_readpage_read_complete,
416 NULL,
417 mapping_gfp_mask(mapping));
418#else
419 ret = -ENOBUFS;
420#endif
421
422 switch (ret) {
423 /* all pages are being read from the cache */
424 case 0:
425 BUG_ON(!list_empty(pages));
426 BUG_ON(nr_pages != 0);
427 _leave(" = 0 [reading all]");
428 return 0;
429
430 /* there were pages that couldn't be read from the cache */
431 case -ENODATA:
432 case -ENOBUFS:
433 break;
434
435 /* other error */
436 default:
437 _leave(" = %d", ret);
438 return ret;
439 }
440
David Howells91b467e02017-01-05 10:38:35 +0000441 while (!list_empty(pages)) {
442 ret = afs_readpages_one(file, mapping, pages);
443 if (ret < 0)
444 break;
445 }
David Howells9b3f26c2009-04-03 16:42:41 +0100446
447 _leave(" = %d [netting]", ret);
448 return ret;
David Howellsec268152007-04-26 15:49:28 -0700449}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451/*
David Howells31143d52007-05-09 02:33:46 -0700452 * write back a dirty page
453 */
454static int afs_launder_page(struct page *page)
455{
456 _enter("{%lu}", page->index);
457
458 return 0;
459}
460
461/*
David Howells9b3f26c2009-04-03 16:42:41 +0100462 * invalidate part or all of a page
463 * - release a page and clean up its private data if offset is 0 (indicating
464 * the entire page)
465 */
Lukas Czernerd47992f2013-05-21 23:17:23 -0400466static void afs_invalidatepage(struct page *page, unsigned int offset,
467 unsigned int length)
David Howells9b3f26c2009-04-03 16:42:41 +0100468{
469 struct afs_writeback *wb = (struct afs_writeback *) page_private(page);
470
Lukas Czernerd47992f2013-05-21 23:17:23 -0400471 _enter("{%lu},%u,%u", page->index, offset, length);
David Howells9b3f26c2009-04-03 16:42:41 +0100472
473 BUG_ON(!PageLocked(page));
474
475 /* we clean up only if the entire page is being invalidated */
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300476 if (offset == 0 && length == PAGE_SIZE) {
David Howells9b3f26c2009-04-03 16:42:41 +0100477#ifdef CONFIG_AFS_FSCACHE
478 if (PageFsCache(page)) {
479 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
480 fscache_wait_on_page_write(vnode->cache, page);
481 fscache_uncache_page(vnode->cache, page);
David Howells9b3f26c2009-04-03 16:42:41 +0100482 }
483#endif
484
485 if (PagePrivate(page)) {
486 if (wb && !PageWriteback(page)) {
487 set_page_private(page, 0);
488 afs_put_writeback(wb);
489 }
490
491 if (!page_private(page))
492 ClearPagePrivate(page);
493 }
494 }
495
496 _leave("");
497}
498
499/*
500 * release a page and clean up its private state if it's not busy
501 * - return true if the page can now be released, false if not
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 */
David Howells416351f2007-05-09 02:33:45 -0700503static int afs_releasepage(struct page *page, gfp_t gfp_flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504{
David Howells9b3f26c2009-04-03 16:42:41 +0100505 struct afs_writeback *wb = (struct afs_writeback *) page_private(page);
David Howells416351f2007-05-09 02:33:45 -0700506 struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507
David Howells416351f2007-05-09 02:33:45 -0700508 _enter("{{%x:%u}[%lu],%lx},%x",
509 vnode->fid.vid, vnode->fid.vnode, page->index, page->flags,
510 gfp_flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511
David Howells9b3f26c2009-04-03 16:42:41 +0100512 /* deny if page is being written to the cache and the caller hasn't
513 * elected to wait */
514#ifdef CONFIG_AFS_FSCACHE
David Howells201a1542009-11-19 18:11:35 +0000515 if (!fscache_maybe_release_page(vnode->cache, page, gfp_flags)) {
516 _leave(" = F [cache busy]");
517 return 0;
David Howells9b3f26c2009-04-03 16:42:41 +0100518 }
519#endif
520
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521 if (PagePrivate(page)) {
David Howells9b3f26c2009-04-03 16:42:41 +0100522 if (wb) {
523 set_page_private(page, 0);
524 afs_put_writeback(wb);
525 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 ClearPagePrivate(page);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 }
528
David Howells9b3f26c2009-04-03 16:42:41 +0100529 /* indicate that the page can be released */
530 _leave(" = T");
531 return 1;
David Howellsec268152007-04-26 15:49:28 -0700532}