mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-24 05:01:03 +02:00
afs: Fix to take ref on page when PG_private is set
Fix afs to take a ref on a page when it sets PG_private on it and to drop
the ref when removing the flag.
Note that in afs_write_begin(), a lot of the time, PG_private is already
set on a page to which we're going to add some data. In such a case, we
leave the bit set and mustn't increment the page count.
As suggested by Matthew Wilcox, use attach/detach_page_private() where
possible.
Fixes: 31143d5d51
("AFS: implement basic file write support")
Reported-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
This commit is contained in:
@@ -243,10 +243,8 @@ void afs_edit_dir_add(struct afs_vnode *vnode,
|
||||
index, gfp);
|
||||
if (!page)
|
||||
goto error;
|
||||
if (!PagePrivate(page)) {
|
||||
set_page_private(page, 1);
|
||||
SetPagePrivate(page);
|
||||
}
|
||||
if (!PagePrivate(page))
|
||||
attach_page_private(page, (void *)1);
|
||||
dir_page = kmap(page);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user