Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc71ff8a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  NFS: Ensure that writepage respects the nonblock flag
  NFS: kswapd must not block in nfs_release_page
  nfs: include space for the NUL in root path
parents 1cf66e16 cfb506e1
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@
#include <linux/pagemap.h>
#include <linux/pagemap.h>
#include <linux/aio.h>
#include <linux/aio.h>
#include <linux/gfp.h>
#include <linux/gfp.h>
#include <linux/swap.h>


#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/system.h>
@@ -493,11 +494,19 @@ static void nfs_invalidate_page(struct page *page, unsigned long offset)
 */
 */
static int nfs_release_page(struct page *page, gfp_t gfp)
static int nfs_release_page(struct page *page, gfp_t gfp)
{
{
	struct address_space *mapping = page->mapping;

	dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
	dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);


	/* Only do I/O if gfp is a superset of GFP_KERNEL */
	/* Only do I/O if gfp is a superset of GFP_KERNEL */
	if ((gfp & GFP_KERNEL) == GFP_KERNEL)
	if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL) {
		nfs_wb_page(page->mapping->host, page);
		int how = FLUSH_SYNC;

		/* Don't let kswapd deadlock waiting for OOM RPC calls */
		if (current_is_kswapd())
			how = 0;
		nfs_commit_inode(mapping->host, how);
	}
	/* If PagePrivate() is set, then the page is not freeable */
	/* If PagePrivate() is set, then the page is not freeable */
	if (PagePrivate(page))
	if (PagePrivate(page))
		return 0;
		return 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ static char nfs_root_name[256] __initdata = "";
static __be32 servaddr __initdata = 0;
static __be32 servaddr __initdata = 0;


/* Name of directory to mount */
/* Name of directory to mount */
static char nfs_export_path[NFS_MAXPATHLEN] __initdata = { 0, };
static char nfs_export_path[NFS_MAXPATHLEN + 1] __initdata = { 0, };


/* NFS-related data */
/* NFS-related data */
static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */
static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */
+19 −8
Original line number Original line Diff line number Diff line
@@ -222,7 +222,7 @@ static void nfs_end_page_writeback(struct page *page)
		clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC);
		clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC);
}
}


static struct nfs_page *nfs_find_and_lock_request(struct page *page)
static struct nfs_page *nfs_find_and_lock_request(struct page *page, bool nonblock)
{
{
	struct inode *inode = page->mapping->host;
	struct inode *inode = page->mapping->host;
	struct nfs_page *req;
	struct nfs_page *req;
@@ -241,7 +241,10 @@ static struct nfs_page *nfs_find_and_lock_request(struct page *page)
		 *	 request as dirty (in which case we don't care).
		 *	 request as dirty (in which case we don't care).
		 */
		 */
		spin_unlock(&inode->i_lock);
		spin_unlock(&inode->i_lock);
		if (!nonblock)
			ret = nfs_wait_on_request(req);
			ret = nfs_wait_on_request(req);
		else
			ret = -EAGAIN;
		nfs_release_request(req);
		nfs_release_request(req);
		if (ret != 0)
		if (ret != 0)
			return ERR_PTR(ret);
			return ERR_PTR(ret);
@@ -256,12 +259,12 @@ static struct nfs_page *nfs_find_and_lock_request(struct page *page)
 * May return an error if the user signalled nfs_wait_on_request().
 * May return an error if the user signalled nfs_wait_on_request().
 */
 */
static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
				struct page *page)
				struct page *page, bool nonblock)
{
{
	struct nfs_page *req;
	struct nfs_page *req;
	int ret = 0;
	int ret = 0;


	req = nfs_find_and_lock_request(page);
	req = nfs_find_and_lock_request(page, nonblock);
	if (!req)
	if (!req)
		goto out;
		goto out;
	ret = PTR_ERR(req);
	ret = PTR_ERR(req);
@@ -283,12 +286,20 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio)
static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio)
{
{
	struct inode *inode = page->mapping->host;
	struct inode *inode = page->mapping->host;
	int ret;


	nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
	nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
	nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
	nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);


	nfs_pageio_cond_complete(pgio, page->index);
	nfs_pageio_cond_complete(pgio, page->index);
	return nfs_page_async_flush(pgio, page);
	ret = nfs_page_async_flush(pgio, page,
			wbc->sync_mode == WB_SYNC_NONE ||
			wbc->nonblocking != 0);
	if (ret == -EAGAIN) {
		redirty_page_for_writepage(wbc, page);
		ret = 0;
	}
	return ret;
}
}


/*
/*
@@ -1379,7 +1390,7 @@ static const struct rpc_call_ops nfs_commit_ops = {
	.rpc_release = nfs_commit_release,
	.rpc_release = nfs_commit_release,
};
};


static int nfs_commit_inode(struct inode *inode, int how)
int nfs_commit_inode(struct inode *inode, int how)
{
{
	LIST_HEAD(head);
	LIST_HEAD(head);
	int may_wait = how & FLUSH_SYNC;
	int may_wait = how & FLUSH_SYNC;
@@ -1443,7 +1454,7 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr
	return ret;
	return ret;
}
}
#else
#else
static int nfs_commit_inode(struct inode *inode, int how)
int nfs_commit_inode(struct inode *inode, int how)
{
{
	return 0;
	return 0;
}
}
@@ -1546,7 +1557,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,


	nfs_fscache_release_page(page, GFP_KERNEL);
	nfs_fscache_release_page(page, GFP_KERNEL);


	req = nfs_find_and_lock_request(page);
	req = nfs_find_and_lock_request(page, false);
	ret = PTR_ERR(req);
	ret = PTR_ERR(req);
	if (IS_ERR(req))
	if (IS_ERR(req))
		goto out;
		goto out;
+1 −0
Original line number Original line Diff line number Diff line
@@ -493,6 +493,7 @@ extern int nfs_wb_all(struct inode *inode);
extern int nfs_wb_page(struct inode *inode, struct page* page);
extern int nfs_wb_page(struct inode *inode, struct page* page);
extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
extern int  nfs_commit_inode(struct inode *, int);
extern struct nfs_write_data *nfs_commitdata_alloc(void);
extern struct nfs_write_data *nfs_commitdata_alloc(void);
extern void nfs_commit_free(struct nfs_write_data *wdata);
extern void nfs_commit_free(struct nfs_write_data *wdata);
#endif
#endif