mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
f2fs: initialize page->private when using for our internal use
We need to guarantee it's initially zero. Otherwise, it'll hurt entire flag
operations.
Fixes: b763f3bedc
("f2fs: restructure f2fs page.private layout")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
151b1982be
commit
c9ebd3df43
@ -3819,6 +3819,8 @@ int f2fs_migrate_page(struct address_space *mapping,
|
||||
get_page(newpage);
|
||||
}
|
||||
|
||||
/* guarantee to start from no stale private field */
|
||||
set_page_private(newpage, 0);
|
||||
if (PagePrivate(page)) {
|
||||
set_page_private(newpage, page_private(page));
|
||||
SetPagePrivate(newpage);
|
||||
|
@ -1331,7 +1331,8 @@ enum {
|
||||
#define PAGE_PRIVATE_GET_FUNC(name, flagname) \
|
||||
static inline bool page_private_##name(struct page *page) \
|
||||
{ \
|
||||
return test_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)) && \
|
||||
return PagePrivate(page) && \
|
||||
test_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)) && \
|
||||
test_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \
|
||||
}
|
||||
|
||||
@ -1341,6 +1342,7 @@ static inline void set_page_private_##name(struct page *page) \
|
||||
if (!PagePrivate(page)) { \
|
||||
get_page(page); \
|
||||
SetPagePrivate(page); \
|
||||
set_page_private(page, 0); \
|
||||
} \
|
||||
set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); \
|
||||
set_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \
|
||||
@ -1392,6 +1394,7 @@ static inline void set_page_private_data(struct page *page, unsigned long data)
|
||||
if (!PagePrivate(page)) {
|
||||
get_page(page);
|
||||
SetPagePrivate(page);
|
||||
set_page_private(page, 0);
|
||||
}
|
||||
set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page));
|
||||
page_private(page) |= data << PAGE_PRIVATE_MAX;
|
||||
|
Loading…
Reference in New Issue
Block a user