From: Nick Piggin Fix lock ordering for hostfs. It seems that this filesystem may not be vulnerable to the bug, given that it implements its own writepage, but it is better to retain the safe ordering. Signed-off-by: Hugh Dickins Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton --- fs/hostfs/hostfs_kern.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN fs/hostfs/hostfs_kern.c~hostfs-convert-to-new-aops-fix fs/hostfs/hostfs_kern.c --- a/fs/hostfs/hostfs_kern.c~hostfs-convert-to-new-aops-fix +++ a/fs/hostfs/hostfs_kern.c @@ -16,6 +16,7 @@ #include #include #include +#include /* mark_page_accessed */ #include #include "hostfs.h" #include "kern_util.h" @@ -493,14 +494,15 @@ int hostfs_write_end(struct file *file, if (!PageUptodate(page) && err == PAGE_CACHE_SIZE) SetPageUptodate(page); - unlock_page(page); - page_cache_release(page); /* If err > 0, write_file has added err to pos, so we are comparing * i_size against the last byte written. */ if (err > 0 && (pos > inode->i_size)) inode->i_size = pos; + unlock_page(page); + mark_page_accessed(page); + page_cache_release(page); return err; } _