[Linux-cachefs] [PATCH 17/17] NFS: nfs_migrate_page() does not wait for FS-Cache to finish with a page

Jonathan Nieder jrnieder at gmail.com
Sat Jul 21 16:57:41 UTC 2012


Hi,

In February, David Howells wrote:

> nfs_migrate_page() does not wait for FS-Cache to finish with a page, probably
> leading to the following bad-page-state:
[...]
> nfs_migrate_page() calls nfs_fscache_release_page() which doesn't actually wait
> - even if __GFP_WAIT is set.  The reason that doesn't wait is that
> fscache_maybe_release_page() might deadlock the allocator as the work threads
> writing to the cache may all end up sleeping on memory allocation.
[...]
>  (1) Make nfs_migrate_page() wait.
>
>  (2) Make fscache_maybe_release_page() honour the __GFP_WAIT flag.
>
>  (3) Set a timeout around the wait.
>
>  (4) Make nfs_migrate_page() return an error if the page is still busy.
>
> For the moment, I'll select (2) and (4).
[...]
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -1701,7 +1701,9 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
>  	if (PagePrivate(page))
>  		return -EBUSY;
>  
> -	nfs_fscache_release_page(page, GFP_KERNEL);
> +	ret = -EBUSY;
> +	if (!nfs_fscache_release_page(page, GFP_KERNEL))
> +		goto out;
>  
>  	return migrate_page(mapping, newpage, page, mode);
>  }

Small thing, but it looks like this was forward-ported incorrectly.
Was this ever tested with CONFIG_MIGRATION enabled?

Hope that helps,
Jonathan




More information about the Linux-cachefs mailing list