X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fsplice.c;h=399442179d89d5821b4caccc488fb0180e4e35c0;hb=c72305b5472522299bb6f45b736080128eb1c822;hp=aa5f6f60b3055f8a35b59084f0c652cb0e5c2125;hpb=952f4a0a9b27e6dbd5d32e330b3f609ebfa0b061;p=linux-2.6-omap-h63xx.git diff --git a/fs/splice.c b/fs/splice.c index aa5f6f60b30..399442179d8 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -379,13 +379,22 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, lock_page(page); /* - * page was truncated, stop here. if this isn't the - * first page, we'll just complete what we already - * added + * Page was truncated, or invalidated by the + * filesystem. Redo the find/create, but this time the + * page is kept locked, so there's no chance of another + * race with truncate/invalidate. */ if (!page->mapping) { unlock_page(page); - break; + page = find_or_create_page(mapping, index, + mapping_gfp_mask(mapping)); + + if (!page) { + error = -ENOMEM; + break; + } + page_cache_release(pages[page_nr]); + pages[page_nr] = page; } /* * page was already under io and is now done, great